discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @autoreleasepool casuses seg fault on new install


From: allynm
Subject: Re: @autoreleasepool casuses seg fault on new install
Date: Tue, 9 Jun 2015 09:26:06 -0700 (MST)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]