Drag and Drop to Listbox hangs and crashes app on second drop

In an app built in 13r3.1, I get a hang and a crash on the second drag and drop of a folder from the desktop to a lstbox. The actual drag enters the target and then the app hangs. The first DnD works properly.

Additionally, the normal animation that occurs with the dragged item being “returned” to it’s location in Finder / Desktop does not occur immediately, but rather some 10 to 12 seconds after the drop.

The RS 13r3.1 runtime error Location: path points to CarbonDragItem.cpp:64. The Failure Condition: err == noErr and the Failure Message is to report it. This is very ugly and is causing issues at a couple of very high profile client installations.

<https://xojo.com/issue/30264>

I could be that your drop handler takes too much time or does things the drop sender (e.g. Finder) doesn’t like.

Therefore, decouple the event by using a Timer: In the DropObject event, collect all obj.FolderItem values into a local array (do not store the DropObject directly, that won’t work!) and then use a one-shot Timer with Period=0 in which you then perform the action you did in the Drop handler.

Hi Tim,

multiple drop of a folder onto a ListBox from the Finder (10.8.5 and lower):

This works fine here.

FYI: the drop of a folder (in my project / StandAlone) clears teh ListBox contents and replace it with the name (place the FolderItem in RowTag) of all folders located into (1st level) the dropped folder.
A selection of an entry of the new ListBox contents display data from the selected entry (folder).

For the delay or a rejected object drop: I saw that too.

At last, I use that application since… many years (so it worked - better- with Carbon too).

Thanks @Thomas Tempelmann - of course, there I go promoting callbacks instead of control-based code in another thread and then I do something like this. Do as I say, not as I do strikes again!

Yes, as a matter of fact, the dropobject code was taking upwards of 2 seconds in some cases.

@Emile Schwarz - That’s what I was seeing (and very similar to what I was doing) in pre 10.6 systems as well. This is legacy code and it’s just become an issue in a couple of large sites running 10.8.5 and 10.9GM.

However, that does lead to the question - why does it work properly on the FIRST drop on the new platforms?