compilerplugins/clang/unusedfields.writeonly.results | 2 ++ xmlsecurity/inc/certificatechooser.hxx | 1 + xmlsecurity/source/dialogs/certificatechooser.cxx | 3 +++ 3 files changed, 6 insertions(+)
New commits: commit 3bb9b0565abef14575d1075e7d33ffcc19d51bfd Author: Moritz Duge <moritz.d...@allotropia.de> AuthorDate: Fri May 3 11:35:40 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Fri May 3 15:39:52 2024 +0200 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 687ae6ca01177a04f9ea715a1f1cd70f385a0840. Change-Id: I689cfdaf8d4d62a3b53ff7fb318dc8c70b9e1c2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167020 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Tested-by: Jenkins diff --git a/compilerplugins/clang/unusedfields.writeonly.results b/compilerplugins/clang/unusedfields.writeonly.results index 268c7478b84f..a2110d149d2c 100644 --- a/compilerplugins/clang/unusedfields.writeonly.results +++ b/compilerplugins/clang/unusedfields.writeonly.results @@ -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> diff --git a/xmlsecurity/inc/certificatechooser.hxx b/xmlsecurity/inc/certificatechooser.hxx index 33458c27cd04..494ea40de1e4 100644 --- a/xmlsecurity/inc/certificatechooser.hxx +++ b/xmlsecurity/inc/certificatechooser.hxx @@ -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; diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 2bae90cd7d70..c95ad1947d0b 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -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());