PhilChooser drag and drop exception


#1

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.


#2

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


#3

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.


#4

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]


#5

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


#6

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


#7

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.


#8

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


#9

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.


#10

[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?


#11

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)…


#12

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.


#13

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


#14

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.


#15