[Libreoffice-commits] core.git: vcl/source

Pranav Kant pranavk at collabora.co.uk
Wed Dec 6 12:07:41 UTC 2017


 vcl/source/window/floatwin.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 20f985a4ac2dcc6d287c808b9dcfd055fcbabd91
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Dec 6 16:19:35 2017 +0530

    lokdialog: Show/Hide floating window on StateChangedType::Visible
    
    In the earlier approach, other state change events like SetText are
    emitted which ends up in "else if !IsVisible()" block and tries to close
    the floating window before it's even registered.
    
    Interestingly, this is not the case every time. Anyhow, better safe than
    sorry. Guard the floating window 'created', 'close' callbacks in a
    StateChangeType::Visible event.
    
    Change-Id: Ib997e11fd4a0f50b8911e9891918112e8ff8ef85

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 59b12539e20a..d45707d60aec 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -603,11 +603,12 @@ void FloatingWindow::StateChanged( StateChangedType nType )
 
     SystemWindow::StateChanged( nType );
 
-    if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
+    VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier();
+    if (pParent && nType == StateChangedType::Visible)
     {
-        const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
-        if (nType == StateChangedType::InitShow && IsVisible())
+        if (IsVisible())
         {
+            const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
             SetLOKNotifier(pNotifier);
 
             std::vector<vcl::LOKPayloadItem> aItems;
@@ -619,7 +620,8 @@ void FloatingWindow::StateChanged( StateChangedType nType )
         }
         else if (!IsVisible())
         {
-            pNotifier->notifyWindow(GetLOKWindowId(), "close");
+            assert(GetLOKNotifier());
+            GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "close");
             ReleaseLOKNotifier();
         }
     }


More information about the Libreoffice-commits mailing list