diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-11-12 14:37:17 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-11-12 14:37:17 +0000 |
commit | ee921aafce32843327589ac1b5352a3f04b50f01 (patch) | |
tree | b5852754b066d24c01b85b1064bf7d1ceaf6675a /Source | |
parent | 0e626a9d470fe74612ad7a638251e01efbbc5973 (diff) | |
download | sequelpro-ee921aafce32843327589ac1b5352a3f04b50f01.tar.gz sequelpro-ee921aafce32843327589ac1b5352a3f04b50f01.tar.bz2 sequelpro-ee921aafce32843327589ac1b5352a3f04b50f01.zip |
• tried to improve the release behaviour of the QuickLook Preview Generator
- addresses issue 896
Diffstat (limited to 'Source')
-rw-r--r-- | Source/GeneratePreviewForURL.m | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index 60e5d80c..841fca8d 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -60,8 +60,10 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, NSError *templateReadError = nil; - if (QLPreviewRequestIsCancelled(preview)) + if (QLPreviewRequestIsCancelled(preview)) { + if(pool) [pool release], pool = nil; return noErr; + } // Get current Sequel Pro's set of file icons NSArray *iconImages = [[[NSWorkspace sharedWorkspace] iconForFile:[myURL path]] representations]; @@ -73,8 +75,10 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, NSMutableString *html; NSString *template = nil; - if (QLPreviewRequestIsCancelled(preview)) + if (QLPreviewRequestIsCancelled(preview)) { + if(pool) [pool release], pool = nil; return noErr; + } NSInteger previewHeight = 280; @@ -100,8 +104,9 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain]; if(!spf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { - if(spf) [spf release]; - [pool release]; + if(spf) [spf release], spf = nil; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } @@ -111,7 +116,9 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - [pool release]; + if(spf) [spf release], spf = nil; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } @@ -174,7 +181,9 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - [pool release]; + if(spf) [spf release], spf = nil; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } // compose the html @@ -196,7 +205,9 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - [pool release]; + if(spf) [spf release], spf = nil; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } // compose the html @@ -218,7 +229,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - [pool release]; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } @@ -226,7 +238,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (windowTemplate == nil || ![windowTemplate length] || templateReadError != nil) { - [pool release]; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } @@ -241,8 +254,9 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain]; if(!spf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { - if(spf) [spf release]; - [pool release]; + if(spf) [spf release], spf = nil; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } @@ -362,7 +376,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - [pool release]; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } @@ -465,8 +480,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, } else { // No file attributes were read, bail for safety reasons - [html release]; - [pool release]; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } @@ -482,8 +497,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, (CFDictionaryRef)props ); - [html release]; - [pool release]; + if(html) [html release], html = nil; + if(pool) [pool release], pool = nil; return noErr; } |