From 1ac3738abadb03ce0508d4e69741b4a1d32f8617 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 16 Oct 2018 21:10:22 +0100 Subject: Resolves: tdf#119997 toolbar layout unlock doesn't refresh ui MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit because lock was taken when toolbar layout wasn't set yet Change-Id: I695493d4fb637210c72b9ce53af9f089c79b0c7b Reviewed-on: https://gerrit.libreoffice.org/61848 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sd/source/ui/view/ToolBarManager.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index cb802fd3ef9d..178efab47d41 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -60,12 +60,10 @@ class ToolBarRules; /** Lock of the frame::XLayoutManager. */ -class LayouterLock +struct LayouterLock { -public: explicit LayouterLock (const Reference& rxLayouter); ~LayouterLock(); -private: Reference mxLayouter; }; @@ -577,6 +575,10 @@ void ToolBarManager::Implementation::SetValid (bool bValid) Reference xFrameProperties (xFrame, UNO_QUERY_THROW); Any aValue (xFrameProperties->getPropertyValue("LayoutManager")); aValue >>= mxLayouter; + // tdf#119997 if mpSynchronousLayouterLock was created before mxLayouter was + // set then update it now that its available + if (mpSynchronousLayouterLock && !mpSynchronousLayouterLock->mxLayouter) + mpSynchronousLayouterLock->mxLayouter = mxLayouter; } catch (const RuntimeException&) { @@ -817,11 +819,14 @@ void ToolBarManager::Implementation::Update ( // Note that the lock count may have been increased since // entering this method. In that case one of the next // UnlockUpdate() calls will post the UpdateCallback. - if (mnPendingUpdateCall==nullptr && mnLockCount==0) + if (mnLockCount==0) { mpAsynchronousLayouterLock = std::move(pLocalLayouterLock); - mnPendingUpdateCall = Application::PostUserEvent( - LINK(this,ToolBarManager::Implementation,UpdateCallback)); + if (mnPendingUpdateCall==nullptr) + { + mnPendingUpdateCall = Application::PostUserEvent( + LINK(this,ToolBarManager::Implementation,UpdateCallback)); + } } } else -- cgit