External drag and drop problem in plugin with some DAWs

Hi there,

I’m working on a plugin that requires the ability to drag and drop wav/midi files directly into the host application. I am overriding the “MouseDrag()” function and using “performExternalDragDropOfFiles()” to move a list of selected files to the host. Although it appears to work well in almost every DAW, there are a few that cause issues when I attempt to drag after saving and reopening that session.

In Studio One 4, I will start a new session, load my plugin, and drag files successfully, then I will save that session, close all songs, reopen the saved session, and when I attempt to drag it creates a dmp file and pops up a message that an unexpected error has occurred. Upon inspecting the dmp file, the exception says “The thread tried to read from or write to a virtual address for which it does not have the appropriate access.”. When I traced the error in my code I found that it came down to the line:

bool dragWasSuccessful = dragContainer->performExternalDragDropOfFiles(str, false);

What am I doing wrong? Or have I just stumbled onto a bug in JUCE? If there is any example code that someone could provide or any suggestions of how this can be improved I would greatly appreciate that! The function seems to work with many DAWs but has crashed in both Studio One 4 and Ableton. Thanks in advance!

1 Like

What platform is this on? Have you tested this with the latest version of JUCE from the develop branch?

Hi ed95, I’m using Windows 10 and the latest version of JUCE (v5.4.1)

Can you try the latest tip of develop? This commit fixed an issue that was causing freezing in some DAWs and may be related.

Tried the new commit today with no success. I did some tracing and discovered that the thread in the DragAndDropJob struct is not executed which seems consistent with the exception displayed in the dmp file. I have been able to produce the bug in Reaper as well. It seems that in any DAW, if I choose the option to “close all projects” or “close all songs”, it closes any open projects, then opens a new session which is where the crash occurs. If I close the DAW completely and reopen it then I can open my plugin and drag files with no problems.

Any update on this issue? I’m still getting the same error but am not sure what could be causing it.

I just tried the same drag operation in a JUCE demo project and the same error occurred (tested in Reaper). I can now confirm that this is a bug in JUCE so I would like to know what can be done to correct this. I am fielding several customer complaints a day pertaining to this issue in my plugin and so far have no solution to provide. I will start looking at implementing a drag drop feature on my own instead of using the JUCE provided functions but I hope that a solution is being developed because drag-n-drop is a core feature of my plugin.

This commit should fix the issue.

Thanks ed95, that did the trick! I appreciate the quick response, you and the rest of the JUCE team are awesome! Keep up the great work!