diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-04-01 10:21:50 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-04-01 10:22:46 (GMT) |
commit | 5ec8a27470d4004a60a2d9fc6bd757bbebae1fd7 (patch) | |
tree | 784c06ee9d178725200f42d3cbc957ab672a923b /src/gui | |
parent | eeb83668baf0f396f60882976437299746372217 (diff) | |
download | Qt-5ec8a27470d4004a60a2d9fc6bd757bbebae1fd7.zip Qt-5ec8a27470d4004a60a2d9fc6bd757bbebae1fd7.tar.gz Qt-5ec8a27470d4004a60a2d9fc6bd757bbebae1fd7.tar.bz2 |
QComboBox with Qt::NoFocus triggers a crash.
The showPopup() from a combobox triggers a crash. This happens only for
a combobox which dosen't accept focus and it has been recreated. This is
due to some invalid widget pointer stored in the input context.
Task-number: 249576
Reviewed-by: ddenis
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index c4224ed..09f0f91 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2055,9 +2055,13 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) QWidget *prev = focus_widget; focus_widget = focus; - if (prev && reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason && - prev->testAttribute(Qt::WA_InputMethodEnabled)) { - QInputContext *qic = prev->inputContext(); + if (prev && ((reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason + && prev->testAttribute(Qt::WA_InputMethodEnabled)) + // Do reset the input context, in case the new focus widget won't accept keyboard input + // or it is not created fully yet. + || (focus_widget && (!focus_widget->testAttribute(Qt::WA_InputMethodEnabled) + || !focus_widget->testAttribute(Qt::WA_WState_Created))))) { + QInputContext *qic = prev->inputContext(); if(qic) { qic->reset(); qic->setFocusWidget(0); |