PhilChooser drag and drop exception

hi,

I’ve integrated the PhilChooser in my vst, and I want to drag some files from the PhilChooser to my audio player (which is also in the vst). I made my player a subclass of DragAndDropTarget, and defined the two methods “IsInterestedInDragSource” and “ItemDropped”. I also made my main UI class a subclass of DragAndDropContainer. It should work like this because I remarked that in the ListFileView class of PhilChooser, “startDragging” is called when a drag has started. The problem is that I get an exception when I move the mouse while dragging over my audio player. If I drag and drop the audio file very quickly, it works… Does somebody have an idea? Thanks a lot.

well what’s the exception? If you catch it and see what’s going on it should be obvious what’s happening.

yes I’d like to catch it. When it crashes, Live ask me to use a debugger, so I choose to debug it with my instance of visual C++, but it tells me that it can’t display the source code because “no symbol are loaded for any call stack frame”. I don’t know how to handle this. Thanks in advance for your help.

ah - I think I know what this is, actually. I recently noticed a bugette in the VST code, which although it doesn’t do any harm, throws an assertion, which might be the exception you’re seeing?

The fix is to replace this method, in juce_VstWrapper.cpp, line 788ish:

[code] void doIdleCallback()
{
if (! recursionCheck)
{
MessageManagerLock mml;

        recursionCheck = true;

        juce_callAnyTimersSynchronously();


        // on the mac some hosts (i.e. nuendo) get completely screwed by recursive message
        // loops, because they use an old-fashioned mouse-drag tracking method. Only way to avoid
        // this is by only doing repaints and timers in the idle callback.
        juce_macDoPendingRepaintsNow();

        if (editorComp != 0)
            editorComp->dispatchRepaints();

        recursionCheck = false;
    }
}

[/code]

unfortunatly this has not resolved my problem. I still have an exception and don’t know how to get more information about it. Gonna work on it

You just need to launch the host app with the debugger rather than running it normally.

yes that’s what I did, I “attach a process” and choose the executable of Ableton Live, but visual tells me that Live hasn’t been built with debug symbol, so I won’t be able to view the source code.

doesn’t matter - if your dll has debug info, then you can still debug your own code when it stops in there.

ok, I finally know how to launch Ableton Live with debugger and debug my VST (waou!..). I haven’t reached the moment when I get the exception I told because my program break in juce_image.cpp when I start dragging. It breaks at line 306 in method “multiplyAllAlphas()”:
jassertfalse // can’t do this without alpha-channel!

I suppose it has a link with the image which is drawn while dragging but don’t know how to correct it. Thank you so much for your help.

[quote=“leskimo”]ok, I finally know how to launch Ableton Live with debugger and debug my VST (waou!..). I haven’t reached the moment when I get the exception I told because my program break in juce_image.cpp when I start dragging. It breaks at line 306 in method “multiplyAllAlphas()”:
jassertfalse // can’t do this without alpha-channel!

I suppose it has a link with the image which is drawn while dragging but don’t know how to correct it. Thank you so much for your help.[/quote]

Where’s multiplyAllAlphas() getting called from? It can’t be the call in DragAndDropContainer::startDragging(), can it?

leskimo i found already this bug in philchooser. in ListFileView::mouseDrag, change the temp image to be ARGB and not RGB only…

Image *tempIm = new Image(Image::ARGB, columnWidth, 22, true);
so multiply all alphas now must work. i still can’t see dragging image when compiling in debug mode tho (in release is fine)…

no it’s called from ListFileView::mouseDrag() from the PhilChooser source code. I removed this line and finally catch the exception that I was searching for. I get it when the ListFileView class tries to know if the object dragged is a directory:

if (children[selectedIndex]->isDirectory())
...

“selectedIndex” has a “good” value till I stay on the Phil Explorer, but when I drag my object out of the explorer, sometimes “selectedIndex” is -1, and then it crashes. Maybe I should try to create a variable to stock the index value of the clicked object. I’m gonna try this.

thanx kraken, it has solved the “multiplyAllAlphas” exception.

I works! So I created a variable to stock the index value of the dragged object, doing that I get no more exception. Thank you Jules for your help and patience.