[Interest] [Qt5.x] QComboBox-related crash

Andy asmaloney at gmail.com
Sat Aug 20 00:09:17 CEST 2016


This has me stumped.

Problem:

I have an app with plugins.  Each plugin has a form widget which is
displayed in a dialog.

If I bring up the dialog and click a QComboBox within the form, when I quit
my app I get the following in the console:

  Warning: QBasicTimer::start: QBasicTimer can only be used with threads
started with QThread    (:0, (null))

and the app crashes.

Here's the Mac stack trace:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.qt-project.QtCore             0x0000000101ef98eb
QThreadStorageData::get() const + 43
1   org.qt-project.QtGui              0x0000000101904d36
QOpenGLContext::currentContext() + 22
2   org.qt-project.QtGui              0x0000000101b6b483
QPlatformBackingStorePrivate::~QPlatformBackingStorePrivate() + 19
3   org.qt-project.QtGui              0x0000000101b6b2c1
QPlatformBackingStore::~QPlatformBackingStore() + 33
4   libqcocoa.dylib                   0x0000000105168d7e
QCocoaBackingStore::~QCocoaBackingStore() + 14
5   org.qt-project.QtGui              0x0000000101a6b8cc
QBackingStore::~QBackingStore() + 28
6   org.qt-project.QtWidgets          0x00000001011fa5fc
deleteBackingStore(QWidgetPrivate*) + 204
7   org.qt-project.QtWidgets          0x00000001011fa408
QWidgetPrivate::deleteTLSysExtra() + 56
8   org.qt-project.QtWidgets          0x00000001011fa172
QWidget::destroy(bool, bool) + 834
9   org.qt-project.QtWidgets          0x00000001011f98d6
QWidget::~QWidget() + 1462
10  org.qt-project.QtWidgets          0x00000001012d753e
QComboBoxPrivateContainer::~QComboBoxPrivateContainer() + 62
11  org.qt-project.QtCore             0x00000001020e0a83
QObjectPrivate::deleteChildren() + 227
12  org.qt-project.QtWidgets          0x00000001011f98ba
QWidget::~QWidget() + 1434
13  org.qt-project.QtWidgets          0x00000001012d03f7
QComboBox::~QComboBox() + 71
14  org.qt-project.QtCore             0x00000001020e0a83
QObjectPrivate::deleteChildren() + 227
15  org.qt-project.QtWidgets          0x00000001011f98ba
QWidget::~QWidget() + 1434
16  (my form destructor)

and the Windows stack trace:

1
QThreadStorageData::get
qthreadstorage.cpp        117   0x6b79923c
2
qThreadStorage_localData<QGuiGLThreadContext>
qthreadstorage.h          65    0x3b878f0
3  QThreadStorage<QGuiGLThreadContext
*>::localData                                 qthreadstorage.h
139   0x3bb72dc
4
QOpenGLContext::currentContext
qopenglcontext.cpp        415   0x388b59b
5
QPlatformBackingStorePrivate::~QPlatformBackingStorePrivate
qplatformbackingstore.cpp 84    0x3be3f93
6
QPlatformBackingStore::~QPlatformBackingStore
qplatformbackingstore.cpp 608   0x3a64b6a
7
QWindowsBackingStore::~QWindowsBackingStore
qwindowsbackingstore.cpp  62    0x62891f4c
8
QWindowsBackingStore::~QWindowsBackingStore
qwindowsbackingstore.cpp  65    0x62891f75
9
QBackingStore::~QBackingStore
qbackingstore.cpp         142   0x3995f8f
10
deleteBackingStore
qwidget.cpp               1858  0xef95352
11
QWidgetPrivate::deleteTLSysExtra
qwidget.cpp               1875  0xef953e4
12
QWidget::destroy
qwidget.cpp               12297 0xefad3b7
13
QWidget::~QWidget
qwidget.cpp               1679  0xef94c46
14
QFrame::~QFrame
qframe.cpp                256   0xf0b3d8a
15
QComboBoxPrivateContainer::~QComboBoxPrivateContainer
qcombobox_p.h             208   0xf2fb8f2
16
QComboBoxPrivateContainer::~QComboBoxPrivateContainer
qcombobox_p.h             208   0xf2fb8a3
17
QObjectPrivate::deleteChildren
qobject.cpp               1963  0x6b8f6ed7
18
QWidget::~QWidget
qwidget.cpp               1674  0xef94c18
19
QComboBox::~QComboBox
qcombobox.cpp             1332  0xf088949
20
QComboBox::~QComboBox
qcombobox.cpp             1343  0xf08897f
21
QObjectPrivate::deleteChildren
qobject.cpp               1963  0x6b8f6ed7
22
QWidget::~QWidget
qwidget.cpp               1674  0xef94c18
23
QGroupBox::~QGroupBox
qgroupbox.cpp             206   0xf0b4dc8
24 (my form destructor)


Possibly relevant info:

0) the form is being created & displayed in a plugin
1) the combo box is in a QGroupBox created with a designer form (.ui file)
2) the form widget itself is created once with "new Ui::FormName /
setupUi()" when the plugin is loaded
3) the dialog takes temporary ownership of the widget and calls
widget->setParent( nullptr ); in its destructor so the form does not get
destructed
4) 4.x does not crash (been working for 10 years...)
5) 5.6.x and any 5.7 versions I have tried cause a crash
6) it crashes on both Mac OS X and Windows
7) I'm not doing anything funky with the combo box - just displaying it and
taking action on selection
8) combo boxes in my main app don't seem to be an issue
9) if I don't touch the combo boxes (i.e. display the dialog, dismiss it,
and quit my app) -> no crash

Theories I haven't been able to prove/disprove:

1) there's a singleshot that is fired to display the popup selection and
it's deleting or doing something it shouldn't
2) it's a thread problem because this is in a plugin
3) something isn't liking the dialog's temporary ownership of the form

Anyone with some in-depth knowledge of the QComboBox have any ideas what
might be going on here?

Thank you for your time.

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160819/3de552c1/attachment.html>


More information about the Interest mailing list