fix crash in CertificateChooser for GPG

mvUserData is still needed to keep it's content from being deleted.

Revert "Drop unused instance variable."

This reverts commit 687ae6ca01.

Change-Id: I689cfdaf8d4d62a3b53ff7fb318dc8c70b9e1c2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167020
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Moritz Duge
2024-05-03 15:39:52 +02:00
committed by Thorsten Behrens
parent 510e622495
commit 3bb9b0565a
3 changed files with 6 additions and 0 deletions
@@ -1351,6 +1351,8 @@ xmloff/source/forms/officeforms.hxx:68
xmloff/source/text/txtimp.cxx:104
XMLTextImportHelper::Impl m_xFrameImpPrMap rtl::Reference<SvXMLImportPropertyMapper>
xmlsecurity/inc/certificatechooser.hxx:57
CertificateChooser mvUserData std::vector<std::shared_ptr<UserData> >
xmlsecurity/inc/certificateviewer.hxx:51
CertificateViewer mxGeneralPage std::unique_ptr<CertificateViewerGeneralTP>
xmlsecurity/inc/certificateviewer.hxx:52
CertificateViewer mxDetailsPage std::unique_ptr<CertificateViewerDetailsTP>
+1
View File
@@ -51,6 +51,7 @@ class CertificateChooser final : public weld::GenericDialogController
{
private:
std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > > mxSecurityContexts;
std::vector<std::shared_ptr<CertificateChooserUserData>> mvUserData;
bool mbInitialized;
CertificateChooserUserAction const meAction;
@@ -217,6 +217,9 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
userData->xSecurityContext = secContext;
userData->xSecurityEnvironment = secEnvironment;
// Needed to keep userData alive. (reference to shared_ptr prevents delete)
mvUserData.push_back(userData);
OUString sIssuer = xmlsec::GetContentPart( xCert->getIssuerName(), xCert->getCertificateKind());
OUString sExpDate = utl::GetDateString(xCert->getNotValidAfter());