diff options
author | Andrew Knight <andrew.knight@theqtcompany.com> | 2014-11-07 11:04:49 +0200 |
---|---|---|
committer | Andrew Knight <andrew.knight@theqtcompany.com> | 2014-11-07 14:54:08 +0100 |
commit | 3d70925ee54d06e90bea392883d230b8ae2b1782 (patch) | |
tree | 2d7a3b576620542bea62c198e54ece079d24d624 /src/plugins/platforms/direct2d | |
parent | 21e5d77e85ced10db6fe9c1bf2e0461195e1560c (diff) |
direct2d: Use simple event posting to avoid event queue lock up
In rare cases, the Windows event loop can be spinning inside the inner
loop and the message hook is never called. This can be triggered on the
Direct2D platform by opening 32+ window handles.
The issue can be worked around by using the same approach Windows CE uses:
don't rely on the message hook to inform the event loop that the post
message has been delivered. Instead, uninstall the hook and let it be
called directly by the event loop.
Task-number: QTBUG-42428
Change-Id: I10280126dd50729bc260aa5f7029549e2e061c01
Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/direct2d')
-rw-r--r-- | src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp | 16 | ||||
-rw-r--r-- | src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp index 142362a065..351f94be2b 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp @@ -39,6 +39,7 @@ #include "qwindowsdirect2dwindow.h" #include "qwindowscontext.h" +#include "qwindowsguieventdispatcher.h" #include <qplatformdefs.h> #include <QtCore/QCoreApplication> @@ -47,6 +48,16 @@ QT_BEGIN_NAMESPACE +class QWindowsDirect2DEventDispatcher : public QWindowsGuiEventDispatcher +{ +public: + QWindowsDirect2DEventDispatcher(QObject *parent = 0) + : QWindowsGuiEventDispatcher(parent) + { + uninstallMessageHook(); // ### Workaround for QTBUG-42428 + } +}; + class QWindowsDirect2DIntegrationPrivate { public: @@ -237,6 +248,11 @@ QPlatformBackingStore *QWindowsDirect2DIntegration::createPlatformBackingStore(Q return new QWindowsDirect2DBackingStore(window); } +QAbstractEventDispatcher *QWindowsDirect2DIntegration::createEventDispatcher() const +{ + return new QWindowsDirect2DEventDispatcher; +} + QWindowsDirect2DContext *QWindowsDirect2DIntegration::direct2DContext() const { return &d->m_d2dContext; diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h index b410464372..c72b22a6e8 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h @@ -56,6 +56,7 @@ public: QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const Q_DECL_OVERRIDE; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; QWindowsDirect2DContext *direct2DContext() const; |