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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Mar 13 16:15:39 UTC 2019


 vcl/inc/qt5/Qt5Instance.hxx  |    2 ++
 vcl/qt5/Qt5Instance.cxx      |   12 ++++++++++--
 vcl/source/window/dialog.cxx |    4 ++--
 3 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 77ddb3bd2ad78304bc882b1c5ba162c2983f4b56
Author:     Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Wed Mar 6 16:10:17 2019 +0300
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Wed Mar 13 17:15:12 2019 +0100

    tdf#123406 KDE5: Update delayed frame destruction
    
    Move deleteLater() call to the different event loop.
    This fixes issue with frames not being disposed of
    deterministically, and previously opened window
    not reactivating.
    
    Also hide modal dialog window before unsetting modal mode.
    Unsetting modal mode may require to toggle window visibility.
    Window will be hidden soon anyway,
    and additional generated events might make finding correct
    focused window harder.
    
    Change-Id: Id7839f817075785287b09f6ac79eb3fb211726aa
    Reviewed-on: https://gerrit.libreoffice.org/68852
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 38ead9ed9036..52153846faa1 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -53,10 +53,12 @@ public:
 private Q_SLOTS:
     bool ImplYield(bool bWait, bool bHandleAllCurrentEvents);
     void ImplRunInMain();
+    static void deleteObjectLater(QObject* pObject);
 
 Q_SIGNALS:
     bool ImplYieldSignal(bool bWait, bool bHandleAllCurrentEvents);
     void ImplRunInMainSignal();
+    void deleteObjectLaterSignal(QObject* pObject);
 
 public:
     explicit Qt5Instance(bool bUseCairo = false);
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 4527aaae5ebc..05ebf9aafb1b 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -219,6 +219,12 @@ Qt5Instance::Qt5Instance(bool bUseCairo)
             Qt::BlockingQueuedConnection);
     connect(this, &Qt5Instance::ImplRunInMainSignal, this, &Qt5Instance::ImplRunInMain,
             Qt::QueuedConnection); // no Blocking!
+
+    // this one needs to be queued non-blocking
+    // in order to have this event arriving to correct event processing loop
+    connect(this, &Qt5Instance::deleteObjectLaterSignal, this,
+            [](QObject* pObject) { Qt5Instance::deleteObjectLater(pObject); },
+            Qt::QueuedConnection);
 }
 
 Qt5Instance::~Qt5Instance()
@@ -230,6 +236,8 @@ Qt5Instance::~Qt5Instance()
         free(m_pFakeArgvFreeable[i]);
 }
 
+void Qt5Instance::deleteObjectLater(QObject* pObject) { pObject->deleteLater(); }
+
 SalFrame* Qt5Instance::CreateChildFrame(SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle)
 {
     return new Qt5Frame(nullptr, nStyle, m_bUseCairo);
@@ -246,7 +254,7 @@ void Qt5Instance::DestroyFrame(SalFrame* pFrame)
     if (pFrame)
     {
         assert(dynamic_cast<Qt5Frame*>(pFrame));
-        static_cast<Qt5Frame*>(pFrame)->deleteLater();
+        Q_EMIT deleteObjectLaterSignal(static_cast<Qt5Frame*>(pFrame));
     }
 }
 
@@ -261,7 +269,7 @@ void Qt5Instance::DestroyObject(SalObject* pObject)
     if (pObject)
     {
         assert(dynamic_cast<Qt5Object*>(pObject));
-        static_cast<Qt5Object*>(pObject)->deleteLater();
+        Q_EMIT deleteObjectLaterSignal(static_cast<Qt5Object*>(pObject));
     }
 }
 
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 219cf1416237..6f755e4139fb 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1098,6 +1098,8 @@ void Dialog::EndDialog( long nResult )
 
     const bool bModal = GetType() != WindowType::MODELESSDIALOG;
 
+    Hide();
+
     if (bModal)
     {
         SetModalInputMode(false);
@@ -1122,8 +1124,6 @@ void Dialog::EndDialog( long nResult )
         }
     }
 
-    Hide();
-
     if (bModal && GetParent())
     {
         NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );


More information about the Libreoffice-commits mailing list