Hello Alessandro,

The code I'm using was created originally by Tobias Lensing and is available
at http://blog.tlensing.org/2013/3/02/24/.

The version I'm posting is somewhat hacked up with comments.  Please excuse. 
It fails as soon as it hits the first @autoreleasepool.


Mark Allyn wrote
> //
> //  main.m
> //  Just a little test case for Objective-C 2.0 on Ubuntu
> //
> //  Created by Tobias Lensing on 2/22/13.
> //  More cool stuff available at blog.tlensing.org.
> //
>  
> #import 
> <
> Foundation/Foundation.h
> >
> #import 
> <
> AppKit/AppKit.h
> >
> #import 
> <
> dispatch/dispatch.h
> >
>  
> int main(int argc, const char * argv[])
> {    
>      @autoreleasepool {
>     //        NSAutoreleasePool * pool  = [[NSAutoreleasePool alloc] init];
>         int multiplier = 7;
>         int (^myBlock)(int) = ^(int num) {
>             return num * multiplier;
>         };
>          
>        NSLog(@"%d", myBlock(3));
>  }
>        dispatch_queue_t queue = dispatch_queue_create(NULL, NULL); 
>  
>         dispatch_sync(queue, ^{
>             printf("Hello, world from a dispatch queue!\n");
>         });
>  
>         dispatch_release(queue);       
>      
>    //[pool drain];
>    // NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>     @autoreleasepool{
>         [NSApplication sharedApplication];
>         NSRunAlertPanel(@"Test", @"Wow it works!", @"OK", nil, nil);
>     //[pool drain];
>       }          
>     return 0;
> }

If I do traditional NSAutoreleasePool  * pool, all is well.

Thanks,
Mark Allyn



--
View this message in context: 
http://gnustep.8.n7.nabble.com/autoreleasepool-casuses-seg-fault-on-new-install-tp39346p39348.html
Sent from the GNUstep - General mailing list archive at Nabble.com.

_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to