Skip to main content
Known Participant
October 6, 2015
Answered

Illustrator CC 2014 plugin with newer Xcode crashes on startup

  • October 6, 2015
  • 1 reply
  • 3775 views
Please download the attached file to view this post
This topic has been closed for replies.
Correct answer LeoTaro

After debugging it in more detail i found the code but doesn't know what is wrong here:

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
    NSString *applicationSupportDirectory = [paths objectAtIndex:0];

    const std::string returnString([applicationSupportDirectory UTF8String]);

    // Cleanup the NSArray and the NSString
    [paths release];
    [applicationSupportDirectory release];

    return returnString;

After I changed it to the following everthing is working fine:

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
    NSString *applicationSupportDirectory = [paths objectAtIndex:0];

    const std::string returnString([applicationSupportDirectory UTF8String]);

    // Cleanup the NSArray and the NSString
    [pool release];
    return returnString;

So, is the manual release wrong and is the memory being freed in the second example?

Best Regards


NoRulez wrote:

After debugging it in more detail i found the code but doesn't know what is wrong here:

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
    NSString *applicationSupportDirectory = [paths objectAtIndex:0];

    const std::string returnString([applicationSupportDirectory UTF8String]);

    // Cleanup the NSArray and the NSString
    [paths release];
    [applicationSupportDirectory release];

[applicationSupportDirectory release] is definitely wrong as it is just pointing to an item in the paths array. Doing a quick Google search for NSSearchPathForDirectoriesInDomains it seems you don't need to free up paths either (although some people claim it leaks memory).

So I don't think you need to release either, though I am not an objective C expert. If this is the case then using the NSAutoReleasePool will have no effect.

1 reply

Inspiring
October 6, 2015

Seems to be crashing in an NSAutoreleasePool release, but it is crashing in the Illustrator app rather than your plugin. Do you use NSAutoreleasePool in your code? Maybe it is crashing when Illustrator tries to load your plugin. Do you have anything strange in your Info.plist or your plugin's rsrc file? Do you see any errors in the console window?

NoRulezAuthor
Known Participant
October 7, 2015

Hello and thanks for your answer.

No I don't use NSAutoreleasePool. The problem is that Illustrator starts if I remove our plugin.

I tried to debug the plugin with Xcode when Illustrator loads it and all went fine but after the Splashscreen Illustrator crashes.

The same *.rsrc and Info.plist file works for CS6, I also checked the directory structure permissions of the *.aip framework.

I've attached a screenshot of the console output.

Thanks in advance

Best Regards

Inspiring
October 7, 2015

If you put a breakpoint at the beginning of PluginMain when you are debugging, does it ever get called?