]> git.lyx.org Git - features.git/commitdiff
#8637 back port of change 0d6f17af: More careful NSAutoreleasePool management
authorStephan Witt <switt@lyx.org>
Wed, 11 Feb 2015 22:45:57 +0000 (23:45 +0100)
committerStephan Witt <switt@lyx.org>
Wed, 11 Feb 2015 22:45:57 +0000 (23:45 +0100)
src/support/linkback/LinkBackProxy.m

index 1e77d9466081cb189d9345ad189c51694c9f2eb7..0f6b71d6646bafc7c31baf352f4472fb6b5d3aa4 100644 (file)
@@ -22,18 +22,12 @@ static NSAutoreleasePool * pool = nil;
        NSMutableSet * keys;
 }
 
-+ (void)load;
 - (LyXLinkBackClient *)init;
 - (BOOL)edit:(NSString *)fileName;
 @end
 
 @implementation LyXLinkBackClient
 
-+ (void)load
-{
-       pool = [[NSAutoreleasePool alloc] init];
-}
-
 - (LyXLinkBackClient *)init
 {
        self = [super init];
@@ -233,10 +227,14 @@ int editLinkBackFile(char const * docName)
 
 void closeAllLinkBackLinks()
 {
-       [linkBackClient release];
-       linkBackClient = nil;
-       
-       [pool release];
-       pool = nil;
+       if (linkBackClient != nil) {
+               [linkBackClient release];
+               linkBackClient = nil;
+       }
+
+       if (pool != nil) {
+               [pool drain];
+               pool = nil;
+       }
 }