From 07df95e75a728fbbce03f6d6efdf9dbceab6c581 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 10 Sep 2024 10:11:54 +0200 Subject: cool#9992 lok doc sign: async DocumentDigitalSignatures::ImplViewSignatures() Currently SfxObjectShell::CheckIsReadonly() has a hack for the LOK case to show the signatures dialog read-only, as only that is async. The next step is to make DocumentDigitalSignatures::ImplViewSignatures() async, though that requires all callers of the function to be async, so make DocumentDigitalSignatures::signScriptingContent() async as well. There is also DocumentDigitalSignatures::signPackage(), but turns out that's dead code, so just remove it. Once this is in place, we had a problem that the callbacks tried to interact with libxmlsec, but the dialog was still alive in DocumentDigitalSignatures::ImplViewSignatures() by the time the callback was running, so there were two DocumentSignatureManager instances at the same time, and both assumes it should call the global libxmlsec init/uninit, which resulted in failing to verify the just created signature. Fix this similar to how Tomaz fixed the same problem around pdfium in commit 067a8a954c8e1d8d6465a4ab5fb61e93f16c26c2 (pdfium: only init pdfium library one and destroy on LO exit, 2020-06-03). Change-Id: I3fb63c06195564732e1576dbd755157e676fb762 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173117 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- xmlsecurity/inc/documentsignaturemanager.hxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'xmlsecurity/inc') diff --git a/xmlsecurity/inc/documentsignaturemanager.hxx b/xmlsecurity/inc/documentsignaturemanager.hxx index ab89e5b96674..9f0c5d61f9e2 100644 --- a/xmlsecurity/inc/documentsignaturemanager.hxx +++ b/xmlsecurity/inc/documentsignaturemanager.hxx @@ -54,6 +54,7 @@ class XComponentContext; } } class PDFSignatureHelper; +class Xmlsec; /// Manages signatures (addition, removal), used by DigitalSignaturesDialog. class XMLSECURITY_DLLPUBLIC DocumentSignatureManager @@ -75,6 +76,7 @@ private: css::uno::Reference mxSecurityContext; css::uno::Reference mxGpgSEInitializer; css::uno::Reference mxGpgSecurityContext; + std::shared_ptr mpXmlsecLibrary; public: DocumentSignatureManager(const css::uno::Reference& xContext, -- cgit