[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - vcl/source

Pranav Kant pranavk at collabora.co.uk
Fri Dec 8 20:02:28 UTC 2017


 vcl/source/window/floatwin.cxx |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

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

    lokdialog: Prevent crash on autopopup and some other dialogs
    
    Cherry-picked from following commits:
    
    (cherry picked from commit 20f985a4ac2dcc6d287c808b9dcfd055fcbabd91)
    (cherry picked from commit 03fa6b15439938044fa95eb9b0584d16cf23db88)
    (cherry picked from commit 42fae43d70d3d1b8fcc9fc6328b1060d6d72abfc)
    
    Change-Id: Ib997e11fd4a0f50b8911e9891918112e8ff8ef85
    Reviewed-on: https://gerrit.libreoffice.org/45942
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 982b9e6eaf1c..e1b7d76638fe 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -608,13 +608,11 @@ void FloatingWindow::StateChanged( StateChangedType nType )
 
     SystemWindow::StateChanged( nType );
 
-    if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
+    VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier();
+    if (pParent)
     {
-        const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
-        if (nType == StateChangedType::InitShow && IsVisible())
+        if (nType == StateChangedType::InitShow)
         {
-            SetLOKNotifier(pNotifier);
-
             std::vector<vcl::LOKPayloadItem> aItems;
             if (pParent == this)
             {
@@ -625,16 +623,18 @@ void FloatingWindow::StateChanged( StateChangedType nType )
             }
             else
             {
+                SetLOKNotifier(pParent->GetLOKNotifier());
                 aItems.emplace_back(std::make_pair("type", "child"));
                 aItems.emplace_back(std::make_pair("parentId", OString::number(pParent->GetLOKWindowId())));
             }
             aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
             aItems.emplace_back(std::make_pair("position", mpImplData->maPos.toString()));
-            pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
+            GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "created", aItems);
         }
-        else if (!IsVisible())
+        else if (!IsVisible() && nType == StateChangedType::Visible)
         {
-            pNotifier->notifyWindow(GetLOKWindowId(), "close");
+            assert(GetLOKNotifier());
+            GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "close");
             ReleaseLOKNotifier();
         }
     }


More information about the Libreoffice-commits mailing list