sfx2/source/doc/objserv.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 4aa8d30c095e08825bc983c699e11f2e88182124
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Oct 22 14:02:57 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Oct 22 17:21:27 2024 +0200

    cool#9992 lok doc sign: never remember previous .uno:Signature params
    
    Do this explicitly, so it can't happen that .uno:Signature with params
    gets dispatched, then .uno:Signature without params still has the old
    XCertificate.
    
    Change-Id: I35c4d5e0e4545fb1aabb9050aa6b11cd10c3ca85
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175414
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index ff628d18059a..190b87ef2e1b 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -620,10 +620,15 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                 }
                 SfxViewFrame* pFrame = GetFrame();
                 SfxViewShell* pViewShell = pFrame ? pFrame->GetViewShell() : 
nullptr;
-                if (!aSignatureCert.empty() && !aSignatureKey.empty() && 
pViewShell)
+                if (pViewShell)
                 {
-                    xCertificate = 
SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey);
-                    pViewShell->SetSigningCertificate(xCertificate);
+                    uno::Reference<security::XCertificate> xSigningCertificate;
+                    if (!aSignatureCert.empty() && !aSignatureKey.empty())
+                    {
+                        xSigningCertificate = 
SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey);
+                    }
+                    // Always set the signing certificate, to clear data from 
a previous dispatch.
+                    pViewShell->SetSigningCertificate(xSigningCertificate);
                 }
 
                 // Async, all code before return has to go into the callback.

Reply via email to