Delete QComboBoxPrivateContainer while the combo box is still alive
Destroying the QComboxBox will, once it reaches the QWidget destructor, close all popups, including the QComboBoxPrivateContainer, which emits signals on behalf of the QComboBox, that is now gone. Regression after d8e110054876b1cbf186e95bac5561a237ee1c13. The old-syle signal-slot syntax had the advantage of not delivering signals to slots in derived classes after that derived class's destructor had finished running (because we called via the virtual qt_metacall). The new syntax made no checks, so a conversion from the old to the new syntax may introduce crashes or other data corruptions at runtime if the destructor had completed. See 0e72a846d379ba02ff80ecac2526640a05b872b6. We also need a QPointer for the QComboBoxPrivateContainer, as the container may be deleted from outside QComboBox, as seen in the tst_QGraphicsProxyWidget::bypassGraphicsProxyWidget() test, where the QGraphicsProxyWidget proxies the QComboBoxPrivateContainer. Pick-to: 6.7 6.6 6.5 Change-Id: I7590cc2821c73a6762f281504aa62f0c2b472252 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
0fa0d01c36
commit
fde358dd90
@ -1455,6 +1455,9 @@ QComboBox::~QComboBox()
|
||||
} QT_CATCH(...) {
|
||||
; // objects can't throw in destructor
|
||||
}
|
||||
|
||||
// Dispose of container before QComboBox goes away
|
||||
delete d->container;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -380,7 +380,7 @@ public:
|
||||
std::array<QMetaObject::Connection, 8> modelConnections;
|
||||
QAbstractItemModel *model = nullptr;
|
||||
QLineEdit *lineEdit = nullptr;
|
||||
QComboBoxPrivateContainer *container = nullptr;
|
||||
QPointer<QComboBoxPrivateContainer> container;
|
||||
#ifdef Q_OS_MAC
|
||||
QPlatformMenu *m_platformMenu = nullptr;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user