Possible Bug in interaction of AlertWindow and Drag/Drop


#1

In my itemDropped method I have the following code:

AlertWindow::showMessageBox(AlertWindow::InfoIcon, T("local item(s) dropped"), sourceDescription); if(sourceDescription.equalsIgnoreCase(String(T("Jam Works Track")))) { ...
The variable sourceDescription is the first argument to itemDropped. The first line outputs the contents of sourceComponent with no errors. The second line throws a bad pointer exception with sourceDescription.text as the culprit.

sourceDescription.text points to the text string correctly before the AlertWindow::showMessageBox call and seems to be overwritten or perhaps deleted during the info.run() call inside AlertWindow::showMessageBox.

Everything works if I leave out the AlertWindow call. Any ideas?

Thanks in advance – Jeff.


#2

ooh… That’s a good one. The string that’s passed in is a reference, and clearly the thing that it’s a reference to is getting changed during your modal loop.

Luckily it’s an easy fix in juce_DragAndDropContainer.cpp:

ddt->itemDropped (String (dragDesc), source, relX, relY);

I’ll get a fix checked in right away…