sfx2/source/sidebar/SidebarController.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 55f65c4d6cf7d1f68fe9c39c42431e6a15d903e6
Author:     Szymon Kłos <[email protected]>
AuthorDate: Fri May 20 19:16:03 2022 +0200
Commit:     Michael Meeks <[email protected]>
CommitDate: Fri May 20 22:26:15 2022 +0200

    lok: sidebar: avoid async call to switch context
    
    This makes us sure we don't trigger actions for other views
    in LOK case.
    
    We need to call Sync() after RequestCall() so it will be executed
    synchronously.
    
    Change-Id: I07af8d34cbbc6bb42e1b8eeef47a921fdc4bf5f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134689
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Meeks <[email protected]>

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index db4f9679e34a..ba1c968d022f 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -332,8 +332,9 @@ void SAL_CALL SidebarController::notifyContextChangeEvent 
(const css::ui::Contex
         maContextChangeUpdate.RequestCall(); // async call, not a prob
                                              // calling with held
                                              // solarmutex
-        // TODO: this call is redundant but mandatory for unit test to update 
context on document loading
-        if (!comphelper::LibreOfficeKit::isActive())
+        if (comphelper::LibreOfficeKit::isActive())
+            maContextChangeUpdate.Sync();
+        else // TODO: this call is redundant but mandatory for unit test to 
update context on document loading
             UpdateConfigurations();
     }
 }
@@ -373,6 +374,8 @@ void SAL_CALL SidebarController::statusChanged (const 
css::frame::FeatureStateEv
         mnRequestedForceFlags |= SwitchFlag_ForceSwitch;
         maContextChangeUpdate.RequestCall(); // async call, ok to call
                                              // with held solarmutex
+        if (comphelper::LibreOfficeKit::isActive())
+            maContextChangeUpdate.Sync();
     }
 }
 
@@ -1028,6 +1031,8 @@ IMPL_LINK(SidebarController, WindowEventHandler, 
VclWindowEvent&, rEvent, void)
                 mpParentWindow->Invalidate();
                 mnRequestedForceFlags |= SwitchFlag_ForceNewDeck | 
SwitchFlag_ForceNewPanels;
                 maContextChangeUpdate.RequestCall();
+                if (comphelper::LibreOfficeKit::isActive())
+                    maContextChangeUpdate.Sync();
                 break;
 
             case VclEventId::ObjectDying:

Reply via email to