diff options
author | David Faure <faure@kde.org> | 2012-11-28 14:00:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-25 10:37:37 +0100 |
commit | a6e5ccbe223c5a606e15556e8708e863442d9f72 (patch) | |
tree | ea5c62b377ba0bdf31e12f79c1c0905daa882921 /src/widgets/widgets/qmdisubwindow.cpp | |
parent | 5c6b2ede3bdfb5ba5eefb6e7cd7c5d3286a1e1b3 (diff) |
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: Ifb24032cde2cd470dcae7cd553ec5ab45a919dd6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets/widgets/qmdisubwindow.cpp')
-rw-r--r-- | src/widgets/widgets/qmdisubwindow.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 4259f75097..b38dea074f 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -164,6 +164,7 @@ #include <private/qmacstyle_mac_p.h> #endif #include <QMdiArea> +#include <QScopedValueRollback> QT_BEGIN_NAMESPACE @@ -2789,6 +2790,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) @@ -3008,7 +3013,8 @@ void QMdiSubWindow::changeEvent(QEvent *changeEvent) if (d->isActive) d->ensureWindowState(Qt::WindowActive); - emit windowStateChanged(oldState, windowState()); + if (d->activationEnabled) + emit windowStateChanged(oldState, windowState()); } /*! |