sfx2/source/control/dispatch.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit de7c95bb8b83e65583501eafdaee088d352a1d92
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Jun 17 18:39:16 2025 +0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jun 19 13:09:09 2025 +0200

    Do not drop read-only flag when searching for a slot
    
    bReadOnly reflects the environment state. During the lookup, for some
    slots, this flag could be reset, because that slot was eligible for
    an exception from general rule. Yet, there could be a situation, when
    a slot has changed the flag, but then was not picked (see 'continue'
    in the end). Then this modified flag state would be used for the next
    slot, which was wrong.
    
    Change-Id: Ie2f7976de6314f4f50b187c286d189f875db527e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186621
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186683
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 8bd78428bc32..9b3242a5d5a2 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1648,9 +1648,11 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, 
SfxSlotServer& rServer)
         if (!pSlot)
             continue;
 
+        bool bLocalReadOnly = bReadOnly;
+
         // This check can be true only if Lokit is active and view is readonly.
         if (bCheckForCommentCommands)
-            bReadOnly = 
!IsCommandAllowedInLokReadOnlyViewMode(pSlot->GetCommand());
+            bLocalReadOnly = 
!IsCommandAllowedInLokReadOnlyViewMode(pSlot->GetCommand());
 
         if ( pSlot->nDisableFlags != SfxDisableFlags::NONE &&
              ( static_cast<int>(pSlot->nDisableFlags) & 
static_cast<int>(pObjShell->GetDisableFlags()) ) != 0 )
@@ -1659,7 +1661,7 @@ bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, 
SfxSlotServer& rServer)
         if (!(pSlot->nFlags & SfxSlotMode::VIEWERAPP) && isViewerAppMode)
             return false;
 
-        if ( !( pSlot->nFlags & SfxSlotMode::READONLYDOC ) && bReadOnly )
+        if (!(pSlot->nFlags & SfxSlotMode::READONLYDOC) && bLocalReadOnly)
             return false;
 
         // Slot belongs to Container?

Reply via email to