summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-06-02 14:29:57 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-06-03 02:56:17 (GMT)
commit6a19f835c40419dbf28eb64ad8e7f5960d8b5fb9 (patch)
tree74ba763e93f111b6adf654b6fd3d7ee5ac40dba8
parent79cd573fe46dcd0867ae01ca12304e069bb85d93 (diff)
downloadQt-6a19f835c40419dbf28eb64ad8e7f5960d8b5fb9.zip
Qt-6a19f835c40419dbf28eb64ad8e7f5960d8b5fb9.tar.gz
Qt-6a19f835c40419dbf28eb64ad8e7f5960d8b5fb9.tar.bz2
Avoid a crash when setting a focus in a widget hierarchy containing
both visible and invisible widgets. This is a quick hack to avoid a crash in Qt when setting a focus on a visible widget that has invisible parent. Proper fix was committed into master 1a7da7096bbda17197738061902f4489af234bc0, see it's description for more details. Task-number: 254563 Reviewed-by: Thierry Bastian (cherry picked from commit a5b11b9031f9a2a97b65e9a6134244249845491a)
-rw-r--r--src/gui/kernel/qwidget.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 8d3a571..6533974 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5804,8 +5804,9 @@ void QWidget::setFocus(Qt::FocusReason reason)
void QWidget::clearFocus()
{
QWidget *w = this;
- while (w && w->d_func()->focus_child == this) {
- w->d_func()->focus_child = 0;
+ while (w) {
+ if (w->d_func()->focus_child == this)
+ w->d_func()->focus_child = 0;
w = w->parentWidget();
}
#ifndef QT_NO_GRAPHICSVIEW