diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-02-16 15:33:02 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-02-21 23:56:38 +0000 |
commit | 37206c2baf013b07cd26d416a8ab0db493d7d651 (patch) | |
tree | 5e66dea31e8ade60d7180c6122e74c038b78d367 /src/core/web_contents_adapter_p.h | |
parent | 905017117d38d799bc95d6cfdd0195b717b605b8 (diff) |
Fix Q_ASSERT when dragging an item over WebEngineView
When dragging something over a WebEngineView we're waiting for the
result of the asynchronous DragTargetDragOver using a RunLoop. The
result will be delivered by a call to updateDragAction.
The RunLoop will call MessagePumpForUIQt::Run which spins a QEventLoop.
The QEventLoop will dispatch more posted QDragMoveEvent objects while
we're handling the current QDragMoveEvent. This triggers a recursion
guard's Q_ASSERT when dragging from a QtQuick item onto a WebEngineView.
When waiting for the DragTargetDragOver result we're not interested in
Qt events. Instead of using a RunLoop, implement a poor man's chromium
event loop and actively wait for updateDragAction being called.
In practice, no more than two iterations of the loop are run until
updateDragAction is called. Therefore the extra CPU and sleep times are
negligible.
Task-number: QTBUG-58920
Change-Id: Icfdf9c680c4c9987ac3dbb41fbc3e1403af0fa9f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter_p.h')
-rw-r--r-- | src/core/web_contents_adapter_p.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/core/web_contents_adapter_p.h b/src/core/web_contents_adapter_p.h index 9503b4401..f24070523 100644 --- a/src/core/web_contents_adapter_p.h +++ b/src/core/web_contents_adapter_p.h @@ -61,7 +61,6 @@ #include <QScopedPointer> #include <QSharedPointer> -QT_FORWARD_DECLARE_CLASS(QTimer) QT_FORWARD_DECLARE_CLASS(QWebChannel) class WebEngineContext; @@ -96,11 +95,9 @@ public: int lastFindRequestId; std::unique_ptr<content::DropData> currentDropData; blink::WebDragOperation currentDropAction; - bool inDragUpdateLoop; + bool updateDragActionCalled; gfx::Point lastDragClientPos; gfx::Point lastDragScreenPos; - base::Closure dragUpdateLoopQuitClosure; - QScopedPointer<QTimer> updateDragCursorMessagePollingTimer; }; } // namespace QtWebEngineCore |