Kaydet (Commit) c6f2f4e8 authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Thorsten Behrens

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@entry=0x991c058, enable=enable@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@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@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: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
(cherry picked from commit 621bebd8)
Reviewed-on: https://gerrit.libreoffice.org/72658Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 5ad697fd
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment