summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2012-11-28 13:00:45 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-28 09:04:59 (GMT)
commit8233a15a7480ed0a5fe9a7500ac3cf54f0e63887 (patch)
treed39689a0aec7ceb9d4eaff935156a869eb78591c /src/gui/widgets
parentb3828295fdbfb684591795ca23d846d3e6126c0b (diff)
downloadQt-8233a15a7480ed0a5fe9a7500ac3cf54f0e63887.zip
Qt-8233a15a7480ed0a5fe9a7500ac3cf54f0e63887.tar.gz
Qt-8233a15a7480ed0a5fe9a7500ac3cf54f0e63887.tar.bz2
QMdi: Don't emit subWindowActivated during StyleChange handling.
The handling of StyleChange de-maximizes the child window temporarily, which was emitting subWindowActivated. This would crash lokalize, because deactivating a window means deleting the widgets associated with it, and style-change handling is done in QApplication by looping over QApplication::allWidgets, which would then contain dangling pointers. Full valgrind log at https://bugs.kde.org/show_bug.cgi?id=271494#c7 Change-Id: I256da214bf00fd7925dcee67b4f0414e57fc453b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> (cherry picked from qtbase/a6e5ccbe223c5a606e15556e8708e863442d9f72)
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qmdisubwindow.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp
index 6516fba..61ea385 100644
--- a/src/gui/widgets/qmdisubwindow.cpp
+++ b/src/gui/widgets/qmdisubwindow.cpp
@@ -160,6 +160,7 @@
#include <QMainWindow>
#include <QScrollBar>
#include <QDebug>
+#include <QScopedValueRollback>
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
#include <QMacStyle>
#endif
@@ -2795,6 +2796,10 @@ bool QMdiSubWindow::event(QEvent *event)
bool wasShaded = isShaded();
bool wasMinimized = isMinimized();
bool wasMaximized = isMaximized();
+ // Don't emit subWindowActivated, the app doesn't have to know about our hacks
+ const QScopedValueRollback<bool> activationEnabledSaver(d->activationEnabled);
+ d->activationEnabled = false;
+
ensurePolished();
setContentsMargins(0, 0, 0, 0);
if (wasMinimized || wasMaximized || wasShaded)
@@ -3014,7 +3019,8 @@ void QMdiSubWindow::changeEvent(QEvent *changeEvent)
if (d->isActive)
d->ensureWindowState(Qt::WindowActive);
- emit windowStateChanged(oldState, windowState());
+ if (d->activationEnabled)
+ emit windowStateChanged(oldState, windowState());
}
/*!