diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 77bf8504fa3..9c09b9fc9ff 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -441,7 +441,7 @@ QAccessible::State QAccessibleComboBox::state() const if (QComboBox *cBox = comboBox()) { s.expandable = true; - s.expanded = isValid() && cBox->view()->isVisible(); + s.expanded = isValid() && cBox->view() && cBox->view()->isVisible(); s.editable = cBox->isEditable(); } return s; diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 5899568b8a2..00c23856280 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1472,8 +1472,14 @@ QComboBox::~QComboBox() ; // objects can't throw in destructor } - // Dispose of container before QComboBox goes away - delete d->container; + // Dispose of container before QComboBox goes away. Close explicitly so that + // update cycles back into the combobox (e.g. from accessibility when the + // active window changes) are completed first. + if (d->container) { + d->container->close(); + delete d->container; + d->container = nullptr; + } } /*!