summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Duge <moritz.duge@allotropia.de>2024-05-03 11:35:40 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-05-03 15:39:52 +0200
commit3bb9b0565abef14575d1075e7d33ffcc19d51bfd (patch)
tree12e7a5f300d2dd2e0897fdf38076da9f84f9debb
parentUpdate git submodules (diff)
downloadcore-3bb9b0565abef14575d1075e7d33ffcc19d51bfd.tar.gz
core-3bb9b0565abef14575d1075e7d33ffcc19d51bfd.zip
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.behrens@allotropia.de> Tested-by: Jenkins
-rw-r--r--compilerplugins/clang/unusedfields.writeonly.results2
-rw-r--r--xmlsecurity/inc/certificatechooser.hxx1
-rw-r--r--xmlsecurity/source/dialogs/certificatechooser.cxx3
3 files changed, 6 insertions, 0 deletions
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());