]> git.lyx.org Git - features.git/commitdiff
More careful NSAutoreleasePool management
authorStephan Witt <switt@lyx.org>
Tue, 26 Aug 2014 06:22:12 +0000 (08:22 +0200)
committerStephan Witt <switt@lyx.org>
Tue, 26 Aug 2014 06:22:12 +0000 (08:22 +0200)
src/support/linkback/LinkBackProxy.m

index 8112b313c0db3baae0c158df9ea17288c35c012e..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 drain];
-       pool = nil;
+       if (linkBackClient != nil) {
+               [linkBackClient release];
+               linkBackClient = nil;
+       }
+
+       if (pool != nil) {
+               [pool drain];
+               pool = nil;
+       }
 }