summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-02-25 16:56:59 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-05-22 13:44:47 +0200
commit5be0bd7ca8d8ed890f3a95680a8c7710c473dcdf (patch)
tree7a2780d0348600702e486d10b3e82810c3c118f9 /vcl
parentc6f2f4e86c60fcd23a4ee513ce63404d65806981 (diff)
tdf#119856 vcl: fix Qt warning Qt5Frame::SetModal()
This prints a warning "Cannot create children for a parent that is in a different thread"; let's fix it before it causes another hard to debug crash. 0 check_parent_thread(QObject*, QThreadData*, QThreadData*) (parent=parent@entry=0xe88ca0, parentThreadData=<optimized out>, currentThreadData=<optimized out>) at kernel/qobject.cpp:781 1 check_parent_thread (currentThreadData=<optimized out>, parentThreadData=<optimized out>, parent=0xe88ca0) at kernel/qobject.cpp:822 2 QObject::QObject(QObject*) (this=0x9ed2e80, parent=0xe88ca0) at kernel/qobject.cpp:810 3 Adwaita::GenericData::GenericData(QObject*, QWidget*, int) () at /usr/lib64/qt5/plugins/styles/adwaita.so 4 Adwaita::WidgetStateEngine::registerWidget(QWidget*, QFlags<Adwaita::AnimationMode>) () at /usr/lib64/qt5/plugins/styles/adwaita.so 5 Adwaita::Animations::registerWidget(QWidget*) const () at /usr/lib64/qt5/plugins/styles/adwaita.so 6 Adwaita::Style::polish(QWidget*) () at /usr/lib64/qt5/plugins/styles/adwaita.so 7 QWidget::event(QEvent*) () at /lib64/libQt5Widgets.so.5 8 Qt5Widget::event(QEvent*) (this=0x7321790, pEvent=0x7f90c27d3750) at vcl/qt5/Qt5Widget.cxx:416 9 QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 10 QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 11 QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x7321790, event=0x7f90c27d3750) at kernel/qcoreapplication.cpp:1047 12 QWidget::ensurePolished() const () at /lib64/libQt5Widgets.so.5 13 QWidget::setVisible(bool) () at /lib64/libQt5Widgets.so.5 14 Qt5Frame::SetModal(bool) (this=0x9f411b0, bModal=true) at vcl/qt5/Qt5Frame.cxx:482 Change-Id: Ib6b4d1ee859dfce650422a6c7860abf2eb2686f1 Reviewed-on: https://gerrit.libreoffice.org/68356 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> (cherry picked from commit 69c46bf53363127033a83c019375170550308ae2) Reviewed-on: https://gerrit.libreoffice.org/72659 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/Qt5Frame.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 62d3808ba572..2c7dce84cd07 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -496,21 +496,25 @@ void Qt5Frame::SetModal(bool bModal)
{
if (isWindow())
{
- bool wasVisible = windowHandle()->isVisible();
+ auto* pSalInst(static_cast<Qt5Instance*>(GetSalData()->m_pInstance));
+ assert(pSalInst);
+ pSalInst->RunInMainThread([this, bModal]() {
+ bool wasVisible = windowHandle()->isVisible();
- // modality change is only effective if the window is hidden
- if (wasVisible)
- {
- windowHandle()->hide();
- }
+ // modality change is only effective if the window is hidden
+ if (wasVisible)
+ {
+ windowHandle()->hide();
+ }
- windowHandle()->setModality(bModal ? Qt::WindowModal : Qt::NonModal);
+ windowHandle()->setModality(bModal ? Qt::WindowModal : Qt::NonModal);
- // and shown again if it was visible
- if (wasVisible)
- {
- windowHandle()->show();
- }
+ // and shown again if it was visible
+ if (wasVisible)
+ {
+ windowHandle()->show();
+ }
+ });
}
}