diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-01-05 12:42:49 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-01-05 14:07:31 (GMT) |
commit | f72165460d27860cabd51691f4d935fd74b50f80 (patch) | |
tree | 1eae05a6345264cbce7f42b58c1f1457fe7d7aa5 /src | |
parent | 2f42f8eee39d03a84a24da8b1d047f8e58079a26 (diff) | |
download | Qt-f72165460d27860cabd51691f4d935fd74b50f80.zip Qt-f72165460d27860cabd51691f4d935fd74b50f80.tar.gz Qt-f72165460d27860cabd51691f4d935fd74b50f80.tar.bz2 |
Prevent a crash when creating an inputContext from the QApplication dtor.
When accessing the global input context from the QWidget destructor access it
directly instead of calling a helper function. Don't even bother to create an
input context if QApplication is being destroyed (just in case if the user is
calling the QApplication::inputContext manually from the destructor).
Task-number: QTBUG-7105
Reviewed-by: Simon Hausmann
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_x11.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 4165c95..cdd0c1b 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5230,6 +5230,8 @@ QInputContext *QApplication::inputContext() const { Q_D(const QApplication); Q_UNUSED(d);// only static members being used. + if (QApplicationPrivate::is_app_closing) + return d->inputContext; #ifdef Q_WS_X11 if (!X11) return 0; diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 0bc9cbc..f9db485 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1084,7 +1084,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } else { // release previous focus information participating with // preedit preservation of qic - QInputContext *qic = inputContext(); + QInputContext *qic = QApplicationPrivate::inputContext; if (qic) qic->widgetDestroyed(this); } |