diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-05-18 10:04:45 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-05-19 04:20:24 +0000 |
commit | ef6b8d3081f0bf93d6d59e67c8e3f82c63c511c3 (patch) | |
tree | 07fd0815f7f063fad938d7443cd77a4ee70bfc2c /src | |
parent | 796fff91ac4197d41a82a453e28a1d86399ff5cf (diff) |
QQuickComboBox: fix crash on popup destructionv5.9.0-rc2v5.9.0-rc1v5.9.0
f19e2d5f changed the QQuickComboBox destructor to call setPopup(null)
instead of deleting the popup directly. The reason for this change was
that setPopup() did not only destroy the popup but also disconnected
the visibleChanged() signal to avoid spurious highlightedIndexChanged()
signal emission during ComboBox destruction. There was an undesired
side-effect with this change: it ended up calling destroyDelegate()
during destruction, potentially accessing a destroyed QML context.
Switch back to the old way, and disconnect visibleChanged() in place
instead.
Task-number: QTBUG-57650
Task-number: QTBUG-50992
Change-Id: I49d96710815dfc163e75a7ff82fe0e4742cfbb59
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index c2fc3aff..78297a8e 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -672,7 +672,15 @@ QQuickComboBox::QQuickComboBox(QQuickItem *parent) QQuickComboBox::~QQuickComboBox() { - setPopup(nullptr); + Q_D(QQuickComboBox); + // Disconnect visibleChanged() to avoid a spurious highlightedIndexChanged() signal + // emission during the destruction of the (visible) popup. (QTBUG-57650) + QObjectPrivate::disconnect(d->popup, &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::popupVisibleChanged); + + // Delete the popup directly instead of calling setPopup(nullptr) to avoid calling + // destroyDelegate(popup) and potentially accessing a destroyed QML context. (QTBUG-50992) + delete d->popup; + d->popup = nullptr; } /*! |