diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2012-10-23 16:13:45 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-26 08:26:49 +0200 |
commit | fc209e432b3fa561969ccab37083aa5ee31b6a6d (patch) | |
tree | f8392531753f7768650fb98c1b7bd6754b6301a7 /src | |
parent | 10550cbff189dba8dfc2046c57f1974a2fc8727a (diff) | |
download | qtactiveqt-fc209e432b3fa561969ccab37083aa5ee31b6a6d.tar.gz |
Fix crash when handling WM_PAINT during COM operations
Synchronous expose corrupts painter state if it is done during existing
paint operation, which can happen e.g. when requesting some value from
dumpcpp generated wrapper inside a slot.
Fixed by setting platform native interface property "asyncExpose"
when application uses ActiveQt. This allows Windows QPA plugin to
do an asynchronous exposes instead of synchronous.
Task-number: QTBUG-27209
Change-Id: I93595c1d1dc01601f7a8c4562a145bebb29268b6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/activeqt/container/qaxbase.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 6930c80..70ad8b3 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -56,6 +56,8 @@ #include <qmetaobject.h> #include <qsettings.h> #include <qdebug.h> +#include <QGuiApplication> +#include <qpa/qplatformnativeinterface.h> #ifndef QT_NO_THREAD # include <qmutex.h> @@ -1221,6 +1223,16 @@ bool QAxBase::initialize(IUnknown **ptr) if (*ptr || control().isEmpty()) return false; + // Request asynchronous expose events to be used when application uses ActiveQt objects. + // Otherwise painter can get corrupted if Invoke or some other COM method that cause Windows + // messages to be processed is called during an existing paint operation when WM_PAINT is + // also in the queue. + static bool asyncExposeSet = false; + if (!asyncExposeSet) { + QGuiApplication::platformNativeInterface()->setProperty("asyncExpose", QVariant(true)); + asyncExposeSet = true; + } + *ptr = 0; bool res = false; |