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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 5 12:10:26 UTC 2019


 vcl/qt5/Qt5Frame.cxx |   28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 69c46bf53363127033a83c019375170550308ae2
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Feb 25 16:56:59 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Tue Mar 5 13:09:59 2019 +0100

    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 at 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 at cib.de>

diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index d6f0993d8bd9..eb2314d12240 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();
+            }
+        });
     }
 }
 


More information about the Libreoffice-commits mailing list