summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-06-02 14:29:57 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-06-02 14:34:02 (GMT)
commita5b11b9031f9a2a97b65e9a6134244249845491a (patch)
tree3e25abd2e7738d31a47ad2283c003f3109af9da5 /src
parentad46e77420449ede2cb6c1ea2a810a2614520db9 (diff)
downloadQt-a5b11b9031f9a2a97b65e9a6134244249845491a.zip
Qt-a5b11b9031f9a2a97b65e9a6134244249845491a.tar.gz
Qt-a5b11b9031f9a2a97b65e9a6134244249845491a.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
Diffstat (limited to 'src')
-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 bbf6758..baf3278 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