PDA

View Full Version : IPlug AU crashes GarageBand


Tale
07-23-2010, 10:32 AM
If I load any AU plug-in build with IPlug into GarageBand 5.1, then GarageBand crashes when you close the plug-in's GUI. If you never open the GUI, then everything seems OK. So far I've seen this happening with my own ComboV (http://www.martinic.com/combov/), with the IPlugExample, but also with Schwa's Olga (http://www.stillwellaudio.com/?page_id=37) (which I think is IPlug, but I'm not 100% sure).

I will do some more digging myself, but I'm pretty new to the Mac, and I have no debugging experience with Xcode at all, so any help would be much appreciated. I don't know if this helps, but here's a report of the crashed IPlugExample:

http://www.taletn.com/temp/20100723-report.txt

BTW, I think this (http://forum.cockos.com/showpost.php?p=440554&postcount=11) is the same issue.

Tale
07-23-2010, 01:19 PM
Well, I don't really understand Xcode's debugger yet, but I think I have found the problem. It seems that GarageBand tries to redraw the plug-in window while it's being closed, i.e. it calls the drawRect method (probably one last time) after mGraphics has already been nulled.

Fortunately this is easy to fix. Just look up this bit of code in IGraphicsCocoa.mm:

- (void) drawRect: (NSRect) rect
{
mGraphics->Draw(&ToIRECT(mGraphics, &rect));
}

Add a simple check to it that ensures that mGraphics is still valid:

- (void) drawRect: (NSRect) rect
{
if (mGraphics) mGraphics->Draw(&ToIRECT(mGraphics, &rect));
}

No GarageBand crashes anymore (I hope). :)

EDIT: You will also have to change #define IGRAPHICS_COCOA in IGraphicsCocoa.h to something other than IGraphicsCocoa_v1002 to avoid clashes with other IPlugs that still have this bug.

cerberus
07-24-2010, 04:34 AM
thanks tale; i am just developing for reaper atm, and i'm at the learning stage... i made the changes, as you directed.

i renamed the string "IGraphicsCocoa_v1002" to "IGraphicsCocoa_v1002modified"; i hope that is legal.

i recompiled libIPlug.a and my vst still compiles and works.

my a.u. builds successfully. my au appears in reaper (under "new"), but it crashes reaper when instantiating.
i wonder what might be wrong?

crash log:
http://codepad.org/Ahej8wUC

Tale
07-24-2010, 06:43 AM
i renamed the string "IGraphicsCocoa_v1002" to "IGraphicsCocoa_v1002modified"; i hope that is legal.
Yes, it is legal, but only as long as no one else also named his modified build IGraphicsCocoa_v1002modified (unless of course he's made exactly the same modifications as you did).

my a.u. builds successfully. my au appears in reaper (under "new"), but it crashes reaper when instantiating.
i wonder what might be wrong?

crash log:
http://codepad.org/Ahej8wUC
It says Assertion failed: (imgResourceFound). This means that an image resource file is missing, most likely because you haven't added it to the AU target.

cerberus
07-24-2010, 06:59 AM
yes, that was it. thanks tale!

Tale
07-24-2010, 08:21 AM
You're welcome. :)

BTW, a ComboV beta tester has reported on KVR that my GarageBand bugfix also fixes ComboV crashes in Logic 9.1.1.

bvesco
07-24-2010, 12:53 PM
You managed to get the XCode debugger attached to the DAW and stepping through the plugin? That one has stymied me so far. Any tips or step by step instructions?

Tale
07-24-2010, 01:43 PM
1. In de Xcode project tree add a New Custom Executable... to the Executables, and I then browse to GarageBand.app.
2. Optionally set one or more breakpoints in your source code.
3. Select Debug - Breakpoints On from the Run menu, which will fire up GarageBand, and load your plug-in into GarageBand the usual way.
4. If any of your breakpoints are reached, or if GarageBand crashes, the debugger will automatically appear.

Of course you will have to build/run a debug configuration, and I think it needs to be the same architecture as your machine.