JuceAU::GetProperty() fails during call to createEditor()



I’m trying to build an AU plugin using source that yields a working RTAS under Windows. The AU loads fine in the Juce Plugin Host and even processes audio, but when I try to open the editor UI I get EXC_BAD_ACCESS in the call to CharPointer_UTF8::getAddress() resulting from the following line in JuceAU::GetProperty():

(This is for kAudioUnitProperty_CocoaUI)

I can’t see how this would relate to any of my own code. Any ideas?


Well… I can’t think of any way in which that line could possibly fail to work. A File object always returns a valid string, and toUTF8 always returns a valid pointer. It really just can’t go wrong…

Are you sure it’s not the following line that’s crashing, where it actually loads the bundle?

Might be helpful to do some debugging and find out what the strings are that it’s using?


It’s definitely crashing in toUTF8(). If I set a break point at that line, bundleFile.fullpath.text is pointing to garbage rather than a valid path.



Well, all I can think of would be that maybe the Obj-C++ compiler is failing to correctly handle the scope of the temporary String object that’s involved. Does it work if you rephrase it like this:

const File bundleFile (File::getSpecialLocation (File::currentApplicationFile)); const String bundlePathString (bundleFile.getFullPathName()); NSString* bundlePath = [NSString stringWithUTF8String: bundlePathString.toUTF8()];


It doesn’t work if I rephrase it like that, but it does work if I use the same versions of the AU wrapper and the rest of Juce :oops: !