Latest juce.Plugin demo hangs host on closing when UI opened


#1

Hello.

Download latest juce from subversion.
Build demo plugin as AU.
Open some host(Ableton, or juce demo host).
Open plugin GUI in it.
Press host’s close button.
Result: host hangs for long time.

Thanks, Michail.


#2

No such problems here…

Try debugging it - should be easy to catch it and see what’s going on.


#3

I have the same problem with Ableton Live 7.0. Live crashes consistently when I try to quit Live with my plugin enabled, and occasionally when I try to delete the instance of the plugin. I verified that it works with the Demo Plugin (or at least my renamed version of this plugin). Do you want a detailed crash report, or what would be useful to help you debug this?

I am working from the latest tip as of this afternoon.

Thanks,

Sean Costello


#4

If the demo plugin works, then the crash must be in your own code!

Guys, it doesn’t sound like either of you actually used the debugger before posting - the debugger is your friend, and will save you a lot of time and hassle…


#5

If the demo plugin works, then the crash must be in your own code!

Guys, it doesn’t sound like either of you actually used the debugger before posting - the debugger is your friend, and will save you a lot of time and hassle…[/quote]

I’m sorry - I meant to say that Live CRASHES with the Demo plugin, as described above. It doesn’t work properly. The edit button would have been my friend for my post. It was a long day.

Sean Costello


#6

Ah, that makes more sense!

Well, I was testing it in Live 6 and it works just fine, but maybe something is different in Live 7. I guess I’ll have to get a copy and try it.


#7

Got this:

Thread 0 Crashed:
0 com.ableton.live 0x00109024 0x1000 + 1081380
1 com.ableton.live 0x0023b0d4 0x1000 + 2334932
2 com.ableton.live 0x000e3f95 0x1000 + 929685
3 com.ableton.live 0x000e3fc6 0x1000 + 929734
4 com.ableton.live 0x000e3fc6 0x1000 + 929734
5 com.ableton.live 0x000e3fc6 0x1000 + 929734
6 com.ableton.live 0x000e3fc6 0x1000 + 929734
7 com.ableton.live 0x000e3fc6 0x1000 + 929734
8 com.ableton.live 0x000e3fc6 0x1000 + 929734
9 com.ableton.live 0x0011bf12 0x1000 + 1158930
10 com.ableton.live 0x0040302e 0x1000 + 4202542
11 com.ableton.live 0x003fe3a9 0x1000 + 4182953
12 com.apple.HIToolbox 0x91c9a303 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1181
13 com.apple.HIToolbox 0x91c9973d SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405
14 com.apple.HIToolbox 0x91c995a2 SendEventToEventTargetWithOptions + 58
15 com.apple.HIToolbox 0x91cc7f14 ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 356
16 com.apple.HIToolbox 0x91c9a6bc DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2134
17 com.apple.HIToolbox 0x91c9973d SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405
18 com.apple.HIToolbox 0x91cb6092 SendEventToEventTarget + 52
19 com.apple.AppKit 0x9029d93b _DPSNextEvent + 2015
20 com.apple.AppKit 0x9029cca0 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
21 com.discodsp. 0x15cf5b4b juce::MessageManager::runDispatchLoopUntil(int) + 363 (juce_amalgamated.cpp:272547)
22 com.discodsp. 0x15d21bac juce::MessageManager::doPlatformSpecificShutdown() + 196 (juce_amalgamated.cpp:272578)
23 com.discodsp. 0x15d21c73 juce::MessageManager::~MessageManager() + 103 (juce_amalgamated.cpp:37445)
24 com.discodsp. 0x15d2bd0f juce::shutdownJuce_GUI() + 81 (juce_amalgamated.cpp:16325)
25 com.discodsp. 0x15e4d931 JuceAU::~JuceAU() + 419 (juce_AU_Wrapper.mm:156)
26 com.discodsp. 0x15bad8e8 ComponentBase::ComponentEntryDispatch(ComponentParameters*, ComponentBase*) + 126 (ComponentBase.cpp:72)
27 com.discodsp. 0x15ba8455 AUBase::ComponentEntryDispatch(ComponentParameters*, AUBase*) + 2437 (AUDispatch.cpp:400)
28 com.discodsp. 0x15e5051c MusicDeviceBase::ComponentEntryDispatch(ComponentParameters*, MusicDeviceBase*) + 464 (MusicDeviceBase.cpp:247)
29 com.discodsp. 0x15e4e49d ComponentEntryPoint::Dispatch(ComponentParameters*, JuceAU*) + 199 (ComponentBase.h:91)
30 com.discodsp. 0x15e49a56 DiscoveryProEntry + 30 (juce_AU_Wrapper.mm:1352)
31 …ple.CoreServices.CarbonCore 0x9538dded CallComponentDispatch + 29
32 …ple.CoreServices.CarbonCore 0x9538eb2d CallComponentClose + 43
33 …ple.CoreServices.CarbonCore 0x9538ea51 CloseComponentInternal(ComponentInstanceRecord*) + 101
34 …ple.CoreServices.CarbonCore 0x9538e9d2 CloseComponent + 46
35 com.ableton.live 0x01340215 catch_exception_raise + 11366333
36 com.ableton.live 0x010e04e3 catch_exception_raise + 8876683
37 com.ableton.live 0x00516e83 0x1000 + 5332611
38 com.ableton.live 0x0186b934 OMessageQueue::ProcessAndSubMessage() + 190
39 com.ableton.live 0x00dc2901 catch_exception_raise + 5609129
40 com.ableton.live 0x00513aba 0x1000 + 5319354
41 com.ableton.live 0x001bfe0b 0x1000 + 1830411
42 com.ableton.live 0x002c4bae 0x1000 + 2898862
43 com.ableton.live 0x01611aa9 TIndexUpdateLocation::TIndexUpdateLocation(TIndexUpdateLocation const&) + 111873
44 com.ableton.live 0x002e402d 0x1000 + 3026989
45 com.ableton.live 0x002e1c41 0x1000 + 3017793
46 com.ableton.live 0x01634bf6 TListable::~TListable() + 15608
47 com.ableton.live 0x000345dd 0x1000 + 210397
48 com.ableton.live 0x0019498c 0x1000 + 1653132
49 com.ableton.live 0x000293a0 0x1000 + 164768
50 com.ableton.live 0x001e083b 0x1000 + 1964091
51 com.ableton.live 0x00119d2d 0x1000 + 1150253
52 com.ableton.live 0x0017125c 0x1000 + 1507932
53 com.ableton.live 0x00159636 0x1000 + 1410614
54 com.ableton.live 0x0012026e 0x1000 + 1176174
55 com.ableton.live 0x0030fa83 0x1000 + 3205763
56 com.ableton.live 0x000a14ab 0x1000 + 656555
57 com.ableton.live 0x003fe3a9 0x1000 + 4182953
58 com.apple.HIToolbox 0x91c9a303 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1181
59 com.apple.HIToolbox 0x91c9973d SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405
60 com.apple.HIToolbox 0x91cb6092 SendEventToEventTarget + 52
61 com.apple.HIToolbox 0x91cea31d SendHICommandEvent(unsigned long, HICommand const*, unsigned long, unsigned long, unsigned char, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 411
62 com.apple.HIToolbox 0x91d10b6f SendMenuCommandWithContextAndModifiers + 59
63 com.apple.HIToolbox 0x91d10b2c SendMenuItemSelectedEvent + 134
64 com.apple.HIToolbox 0x91d10a3e FinishMenuSelection(MenuData*, MenuData*, MenuResult*, MenuResult*, unsigned long, unsigned long, unsigned long, unsigned char) + 162
65 com.apple.HIToolbox 0x91ced5cc MenuSelectCore(MenuData*, Point, double, unsigned long, OpaqueMenuRef**, unsigned short*) + 640
66 com.apple.HIToolbox 0x91d7c248 MenuSelect + 104
67 com.apple.HIToolbox 0x91d7c1b8 HIMenuBar::HandleMouseEvent(OpaqueEventRef*) + 92
68 com.apple.HIToolbox 0x91c9a811 HIObject::EventHook(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 173
69 com.apple.HIToolbox 0x91c9a303 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1181
70 com.apple.HIToolbox 0x91c9973d SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405
71 com.apple.HIToolbox 0x91cb6092 SendEventToEventTarget + 52
72 com.apple.HIToolbox 0x91cc87c3 ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 2579
73 com.apple.HIToolbox 0x91c9a6bc DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2134
74 com.apple.HIToolbox 0x91c9973d SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405
75 com.apple.HIToolbox 0x91cb6092 SendEventToEventTarget + 52
76 com.apple.HIToolbox 0x91d22c60 ToolboxEventDispatcher + 86
77 com.apple.HIToolbox 0x91d1f4ba RunApplicationEventLoop + 222
78 com.ableton.live 0x000a2964 0x1000 + 661860
79 com.ableton.live 0x00002ae6 0x1000 + 6886
80 com.ableton.live 0x00002a0d 0x1000 + 6669

I’ll debug this moment tommorow.


#8

Thanks, I’ve just checked in a fix for it now.


#9

Cool, thanks!


#10

From my initial tests, that seems to have done the trick. Thanks!

I now have plugins built with code from the tip, that work in Carbon hosts (Live 7.0), Cocoa hosts (Logic, Garage Band), and on the PC.


#11

I posted too soon, apparently. My AUs work great in Live now, but the VSTs crash Live when deleting the plugin, or closing Live. Here’s the crash log:

[code]Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000172196c0
Crashed Thread: 0

Thread 0 Crashed:
0 libobjc.A.dylib 0x9570a688 objc_msgSend + 24
1 com.apple.CoreFoundation 0x96c66595 CFRunLoopRunSpecific + 3141
2 com.apple.CoreFoundation 0x96c66c78 CFRunLoopRunInMode + 88
3 com.apple.HIToolbox 0x9234328c RunCurrentEventLoopInMode + 283
4 com.apple.HIToolbox 0x92342fde ReceiveNextEventCommon + 175
5 com.apple.HIToolbox 0x923a1b36 _AcquireNextEvent + 58
6 com.apple.HIToolbox 0x923a0293 RunApplicationEventLoop + 207
7 com.ableton.live 0x000a2304 0x1000 + 660228
8 com.ableton.live 0x00002486 0x1000 + 5254
9 com.ableton.live 0x000023ad 0x1000 + 5037
[/code]


#12

Try the code I’ve just checked in - I’ve not tried it with this problem, but it might be related.


#13

I just did a clean rebuild with rev 751, and the same problem exists. Demo Juce Plugin crashes in OS X 10.5.7, using Ableton Live Lite 7.0.something, when trying to delete the plugin. Same error message as listed above.


#14

I just tried it with Live 7 lite and can’t find any problems… Are you sure you’ve rebuilt everything and that it’s not loading an older version of the plugin?


#15

Hello,

Just downloaded rev 752, did the build from the demo plugin,
renamed .component to .vst, and putted that in my VST folder.

Then in live 7.0.16 :
dragged in the jucedemoplugin, choosed “fermer set live” (that close in french) and crash :

Thread 0 Crashed:
0 libobjc.A.dylib 0x96522688 objc_msgSend + 24
1 com.apple.CoreFoundation 0x9685c942 __CFRunLoopDoObservers + 466
2 com.apple.CoreFoundation 0x9685dc9c CFRunLoopRunSpecific + 844
3 com.apple.CoreFoundation 0x9685ec78 CFRunLoopRunInMode + 88
4 com.apple.HIToolbox 0x957a228c RunCurrentEventLoopInMode + 283
5 com.apple.HIToolbox 0x957a1fde ReceiveNextEventCommon + 175
6 com.apple.HIToolbox 0x95800b36 _AcquireNextEvent + 58
7 com.apple.HIToolbox 0x957ff293 RunApplicationEventLoop + 207
8 com.ableton.live 0x0109366b ALetter::~ALetter() + 38291
9 com.ableton.live 0x000020e2 0x1000 + 4322
10 com.ableton.live 0x00002009 0x1000 + 4105

Hope this helps,

Salvator


#16

Ok. I’m absolutely stumped by this one, I’m afraid.

I’ve tried a whole bunch of things, but can’t see what’s going on. The crash happens after the plugin has been completely unloaded, so it’s not actually any of my code that’s crashing.

At first I thought it must be because an event has been left in the message queue, which then gets delivered after the plugin has gone, and therefore crashes because the objects it refers to have been deleted, but I’ve tested this, and there aren’t any messages being left behind (I’ve just checked-in some new code that tweaks the messaging slightly to make sure of this)

The AU works perfectly, it’s just the VST that’s got this problem, and for me it also happens when you delete the plugin, as well as when you close the session.

But I’ve absolutely no ideas left… It’s impossible to debug because the plugin isn’t loaded when it happens, so it’s just a case of trial-and-error to figure out what Live is having a problem with… Help! Suggestions wanted!


#17

Hello,

It also crash the host “reaper”, though the crash log is slight different :

Thread 0 Crashed:
0 libobjc.A.dylib 0x96522688 objc_msgSend + 24
1 com.apple.AppKit 0x92633ffa -[NSWindow _cancelPerformSelectors] + 398
2 com.apple.AppKit 0x9263269b -[NSWindow dealloc] + 1175
3 com.apple.AppKit 0x926321ad _NXFreeImageCache + 1010
4 com.apple.AppKit 0x92631d3d -[NSCachedImageRep dealloc] + 216
5 com.apple.AppKit 0x92631b0d -[NSImage _freeRepresentation:] + 328
6 com.apple.AppKit 0x92631914 -[NSImage dealloc] + 133
7 com.cockos.reaper 0x002fc97d DeleteObject(void*) + 131
8 com.cockos.reaper 0x003c745a Main_OnAppQuit() + 618

Does it bring something new and usefull ?

Salvator


#18

Thanks, that’s maybe a bit of a hint that it might be window-related…


#19

Ok, I think I’ve got it… If I’m right, it’s because the message dispatch loop needs to run in between closing the window and deleting the plugin itself, which doesn’t happen if you just delete the plugin with its window open. This might be to let the cocoa windowing stuff clean up or something obscure…

It’s a one-liner, but I’d appreciate it if people could try this in various hosts to see if it works:

in VST_Wrapper.mm:

[code]void detachComponentFromWindowRef (Component* comp, void* nsWindow)
{
const ScopedAutoReleasePool pool;

#if ADD_CARBON_BODGE
EventHandlerRef ref = (EventHandlerRef) (void*) (pointer_sized_int)
comp->getComponentProperty (“carbonEventRef”, false, String::empty).getHexValue64();
RemoveEventHandler (ref);
#endif

NSWindow* hostWindow = (NSWindow*) nsWindow;
NSView* pluginView = (NSView*) comp->getWindowHandle();
NSWindow* pluginWindow = [pluginView window];

[hostWindow removeChildWindow: pluginWindow];
comp->removeFromDesktop();

[hostWindow release];

MessageManager::getInstance()->runDispatchLoopUntil (10);

}[/code]


#20

Seems evolving the good way as, in my setup, the crashes (‘on delete’ and ‘on quit’) are gone in Live 7 !

On reaper there is still a crash ‘on quit’ though :

Thread 0 Crashed:
0 libobjc.A.dylib 0x96522688 objc_msgSend + 24
1 com.apple.AppKit 0x92633ffa -[NSWindow _cancelPerformSelectors] + 398
2 com.apple.AppKit 0x9263269b -[NSWindow dealloc] + 1175
3 com.cockos.reaper 0x002f6f28 -[SWELL_APP_PREFIX_modelesswindow dealloc] + 58
4 com.apple.CoreFoundation 0x9686055a CFRelease + 90
5 com.apple.CoreFoundation 0x967ef59d __CFArrayReleaseValues + 221
6 com.apple.CoreFoundation 0x96860708 CFRelease + 216
7 com.apple.Foundation 0x900df45f NSPopAutoreleasePool + 431
8 com.apple.Foundation 0x900e9b32 +[NSAutoreleasePool releaseAllPools] + 50
9 com.apple.AppKit 0x92782bdb -[NSApplication deallocHardCore:] + 505
10 com.apple.AppKit 0x927818b1 -[NSApplication terminate:] + 742
11 com.cockos.reaper 0x00017260 MacRequestQuit() + 48
12 com.cockos.reaper 0x003c1cb8 MainProc(HWND
*, unsigned int, unsigned long, long) + 1288

Thanks !

Salvator