summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksei Nikiforov <darktemplar@basealt.ru>2019-03-06 16:10:17 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-04-02 01:59:19 +0200
commitd622be2d6bcfcc2c7260421e0eaa09c76ce15da2 (patch)
tree1b3692182cf4c11d1179d9f003fffa7f9b05250b
parent4cddc97ad0488cf70dab9e9fc73f54f1f254631a (diff)
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@cib.de> Reviewed-on: https://gerrit.libreoffice.org/70078 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--vcl/inc/qt5/Qt5Instance.hxx2
-rw-r--r--vcl/qt5/Qt5Instance.cxx12
-rw-r--r--vcl/source/window/dialog.cxx4
3 files changed, 14 insertions, 4 deletions
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 91682bd87950..cece484b0316 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -50,10 +50,12 @@ public:
private Q_SLOTS:
bool ImplYield(bool bWait, bool bHandleAllCurrentEvents);
+ static void deleteObjectLater(QObject* pObject);
Q_SIGNALS:
bool ImplYieldSignal(bool bWait, bool bHandleAllCurrentEvents);
std::unique_ptr<SalMenu> createMenuSignal(bool, Menu*);
+ void deleteObjectLaterSignal(QObject* pObject);
public:
explicit Qt5Instance(bool bUseCairo = false);
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 8de9fc7f5712..58f93fea73c6 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -67,6 +67,12 @@ Qt5Instance::Qt5Instance(bool bUseCairo)
Qt::BlockingQueuedConnection);
connect(this, &Qt5Instance::createMenuSignal, this, &Qt5Instance::CreateMenu,
Qt::BlockingQueuedConnection);
+
+ // 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()
@@ -78,6 +84,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);
@@ -94,7 +102,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));
}
}
@@ -109,7 +117,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 0c75f85ae8d3..168816392a30 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1097,6 +1097,8 @@ void Dialog::EndDialog( long nResult )
const bool bModal = GetType() != WindowType::MODELESSDIALOG;
+ Hide();
+
if (bModal)
{
SetModalInputMode(false);
@@ -1121,8 +1123,6 @@ void Dialog::EndDialog( long nResult )
}
}
- Hide();
-
if (bModal && GetParent())
{
NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );