diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-02 21:01:33 +0000 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2019-06-13 19:46:59 +0200 |
commit | c9e626df57a3dd66613ec6b41a7d1ffb8da1843e (patch) | |
tree | fcf61b28db30056af18f61c30c1db40f6532d317 /vcl/qt5 | |
parent | Resolves tdf#125840: Crash when trying to customize Base Data View toolbar (diff) | |
download | core-c9e626df57a3dd66613ec6b41a7d1ffb8da1843e.tar.gz core-c9e626df57a3dd66613ec6b41a7d1ffb8da1843e.zip |
tdf#125692 SalObject always holds a SystemChildWindow
Let's just face reality and store it as a VclPtr.
And this is needed, because Qt, like VCL, uses deferred deletion,
and has no way to filter events to QObjects out of its event queue
easily. This way the qt5 plugin can report focus changes for
SalObjects without a crash, which happens when you close a
presentation with a video by click.
And in addition it reverts the workaround introduced in commit
e770bacc85a0 ("Qt5 workaround modal change after show bug"), as it
seems this bug is a use-after-free error, introduced by LO.
Thanks Michael Weghorn for catching that!
Maybe someone should also rename SalObject...
Reviewed-on: https://gerrit.libreoffice.org/73567
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
(cherry picked from commit 2dc6bdd1d5789ace0500cad90f5d2eb930888bb9)
Reviewed-on: https://gerrit.libreoffice.org/73921
Change-Id: I0bc64ea64f95dfc7a838799c4a04de183adfefcf
Reviewed-on: https://gerrit.libreoffice.org/73962
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index a47d39211ee5..6b738f159ea4 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -33,6 +33,7 @@ #include <QtCore/QMimeData> #include <QtCore/QPoint> #include <QtCore/QSize> +#include <QtCore/QThread> #include <QtGui/QIcon> #include <QtGui/QWindow> #include <QtGui/QScreen> @@ -556,21 +557,18 @@ void Qt5Frame::SetModal(bool bModal) auto* pSalInst(static_cast<Qt5Instance*>(GetSalData()->m_pInstance)); assert(pSalInst); pSalInst->RunInMainThread([this, bModal]() { - bool wasVisible = windowHandle()->isVisible(); + + QWidget* const pChild = m_pTopLevel ? m_pTopLevel : m_pQWidget; + const bool bWasVisible = pChild->isVisible(); // modality change is only effective if the window is hidden - if (wasVisible) - { - windowHandle()->hide(); - } + if (bWasVisible) + pChild->hide(); - windowHandle()->setModality(bModal ? Qt::WindowModal : Qt::NonModal); + pChild->setWindowModality(bModal ? Qt::WindowModal : Qt::NonModal); - // and shown again if it was visible - if (wasVisible) - { - windowHandle()->show(); - } + if (bWasVisible) + pChild->show(); }); } } |