From ef259af2db0d7c58a534cc877eebef3e20d4ebda Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 4 Feb 2015 20:02:59 +0200 Subject: [PATCH] Fix deadlock when starting a drag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie2fdc56bffb97ce04ffad11ea7a7686dc09a06cc Reviewed-by: Robin Burchell Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylanddnd.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp index 996e647ccdc..e38e23da92f 100644 --- a/src/plugins/platforms/wayland/qwaylanddnd.cpp +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -71,13 +71,20 @@ QMimeData * QWaylandDrag::platformDropData() void QWaylandDrag::startDrag() { + bool cancel = false; if (!shapedPixmapWindow()) { QBasicDrag::startDrag(); - QBasicDrag::cancel(); + // Don't call cancel() here, since that will hide 'shapedPixmapWindow()', and + // QWaylandWindow::setVisible(false) will flush the window system queue, + // ending up trying to render the window, which doesn't have a role yet, + // and so blocking waiting for a frame callback. + cancel = true; } QWaylandWindow *icon = static_cast(shapedPixmapWindow()->handle()); m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon); + if (cancel) + QBasicDrag::cancel(); QBasicDrag::startDrag(); }