summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2016-11-11 11:55:27 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-11-11 15:37:35 +0000
commitc27374541e289962df6947967b97178bfa63e9f7 (patch)
tree2f4254eb30b9c5c3eef8ac9f770ddf26c6a5d992 /src/core/web_contents_adapter.cpp
parente70b59112104b72e794c20f7c715482809780d32 (diff)
parent39f7ce19dbce34dfa7e730d6fa743d88109c3369 (diff)
Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index d582993b7..fadbd6d2e 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1113,18 +1113,12 @@ void WebContentsAdapter::setWebChannel(QWebChannel *channel, uint worldId)
static QMimeData *mimeDataFromDropData(const content::DropData &dropData)
{
QMimeData *mimeData = new QMimeData();
- if (!dropData.text.is_null()) {
+ if (!dropData.text.is_null())
mimeData->setText(toQt(dropData.text.string()));
- return mimeData;
- }
- if (!dropData.html.is_null()) {
+ if (!dropData.html.is_null())
mimeData->setHtml(toQt(dropData.html.string()));
- return mimeData;
- }
- if (dropData.url.is_valid()) {
+ if (dropData.url.is_valid())
mimeData->setUrls(QList<QUrl>() << toQt(dropData.url));
- return mimeData;
- }
return mimeData;
}
@@ -1216,6 +1210,16 @@ Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const Q
rvh->DragTargetDragOver(toGfx(e->pos()), toGfx(screenPos), toWeb(e->possibleActions()),
blink::WebInputEvent::LeftButtonDown);
+ base::MessageLoop *currentMessageLoop = base::MessageLoop::current();
+ DCHECK(currentMessageLoop);
+ if (!currentMessageLoop->NestableTasksAllowed()) {
+ // We're already inside a MessageLoop::RunTask call, and scheduled tasks will not be
+ // executed. That means, updateDragAction will never be called, and the RunLoop below will
+ // remain blocked forever.
+ qWarning("WebContentsAdapter::updateDragPosition called from MessageLoop::RunTask.");
+ return Qt::IgnoreAction;
+ }
+
// Wait until we get notified via RenderViewHostDelegateView::UpdateDragCursor. This calls
// WebContentsAdapter::updateDragAction that will eventually quit the nested loop.
base::RunLoop loop;