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

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


 vcl/qt5/Qt5FilePicker.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 621bebd8640feeb5f8e15fafac1425cb18bd28e4
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Feb 25 16:38:36 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Tue Mar 5 12:56:46 2019 +0100

    tdf#119856 vcl: fix Qt5FilePicker destructor to run in main thread
    
    During QFileDialog dtor, QSocketNotifier::setEnabled(false) is called,
    but it doesn't do anything other than print a stupid warning and so it's
    still registered and later it receives events after it's dead.
    
    0   QSocketNotifier::setEnabled(bool) (this=this at entry=0x991c058, enable=enable at entry=false) at kernel/qsocketnotifier.cpp:240
    1   QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine() (this=0x991c030, __in_chrg=<optimized out>) at io/qfilesystemwatcher_inotify.cpp:260
    2   QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine() (this=0x991c030, __in_chrg=<optimized out>) at io/qfilesystemwatcher_inotify.cpp:258
    3   QObjectPrivate::deleteChildren() (this=this at entry=0x991c240) at kernel/qobject.cpp:1997
    4   QObject::~QObject() (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:1025
    5   QFileSystemWatcher::~QFileSystemWatcher() (this=0x9641b60, __in_chrg=<optimized out>) at io/qfilesystemwatcher.cpp:277
    6   QObjectPrivate::deleteChildren() (this=this at entry=0x2a30130) at kernel/qobject.cpp:1997
    7   QObject::~QObject() (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:1025
    8   QThread::~QThread() (this=0x2a079b8, __in_chrg=<optimized out>) at thread/qmutex.h:217
    9    () at /lib64/libQt5Widgets.so.5
    10  QScopedPointerDeleter<QObjectData>::cleanup(QObjectData*) (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:52
    11  QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer() (this=0x98aa4d8, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:107
    12  QObject::~QObject() (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:884
    13  QFileSystemModel::~QFileSystemModel() () at /lib64/libQt5Widgets.so.5
    14  QObjectPrivate::deleteChildren() (this=0x97bab00) at kernel/qobject.cpp:1997
    15  QWidget::~QWidget() () at /lib64/libQt5Widgets.so.5
    16  QFileDialog::~QFileDialog() () at /lib64/libQt5Widgets.so.5
    17  std::default_delete<QFileDialog>::operator()(QFileDialog*) const (this=0x9770f90, __ptr=0x926e970) at /usr/include/c++/8/bits/unique_ptr.h:81
    18  std::unique_ptr<QFileDialog, std::default_delete<QFileDialog> >::~unique_ptr() (this=0x9770f90, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/unique_ptr.h:274
    19  Qt5FilePicker::~Qt5FilePicker() (this=0x9770ed0, __in_chrg=<optimized out>) at vcl/qt5/Qt5FilePicker.cxx:155
    
    Change-Id: Iddfa3d44de59e1760e20a389566d9e6815ab26f7
    Reviewed-on: https://gerrit.libreoffice.org/68355
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx
index 9df730351bca..282723ff12fb 100644
--- a/vcl/qt5/Qt5FilePicker.cxx
+++ b/vcl/qt5/Qt5FilePicker.cxx
@@ -23,6 +23,7 @@
 #include <Qt5Frame.hxx>
 #include <Qt5Tools.hxx>
 #include <Qt5Widget.hxx>
+#include <Qt5Instance.hxx>
 
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
@@ -167,7 +168,16 @@ Qt5FilePicker::Qt5FilePicker(QFileDialog::FileMode eMode, bool bShowFileExtensio
             SLOT(updateAutomaticFileExtension()));
 }
 
-Qt5FilePicker::~Qt5FilePicker() {}
+Qt5FilePicker::~Qt5FilePicker()
+{
+    auto* pSalInst(static_cast<Qt5Instance*>(GetSalData()->m_pInstance));
+    assert(pSalInst);
+    pSalInst->RunInMainThread([this]() {
+        // must delete it in main thread, otherwise
+        // QSocketNotifier::setEnabled() will crash us
+        m_pFileDialog.reset();
+    });
+}
 
 void SAL_CALL
 Qt5FilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener)


More information about the Libreoffice-commits mailing list