From 146c8573ca26cae855dc79e18742447a70163fb8 Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 13 Apr 2021 14:54:18 +0100 Subject: [PATCH] X11: Fix drag-n-drop bug in the XWindowSystem class This resolves a regression which was introduced in 74ca3b44c4df30df20a36613b4ceb0d71abfbf33. Prior to that commit, drag and drop on Linux/X11 worked as expected. DragAndDropContainer::performExternalDragDropOfFiles allowed dropping files onto other applications. After the faulty commit, this function may cause the window manager to enter a bad state in which the drag operation never finishes, making it impossible to switch between windows or close windows. I think the issue happens because the DnD source may receive (spurious?) XdndLeave messages during the drag, which cause the peer's entry in the dragAndDropStateMap to be removed. Before the faulty commit, each peer had its own drag and drop state object, which was not destroyed in this way. This change will keep the peer's drag state object alive, even when an XdndLeave message is received. The entry will still be removed when the peer's window is destroyed. --- modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp index fa6f54da56..6b65e14c3e 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp @@ -3617,7 +3617,6 @@ void XWindowSystem::handleClientMessageEvent (LinuxComponentPeer* peer, XClientM else if (clientMsg.message_type == atoms.XdndLeave) { dragAndDropStateMap[peer].handleDragAndDropExit(); - dragAndDropStateMap.erase (peer); } else if (clientMsg.message_type == atoms.XdndPosition) {