Modified:
trunk/ReleaseNotes.html
trunk/XIPreviewController.m
Log:
fix a crash bug in preview.
Modified: trunk/ReleaseNotes.html
==============================================================================
--- trunk/ReleaseNotes.html (original)
+++ trunk/ReleaseNotes.html Fri Aug 15 08:27:23 2008
@@ -8,6 +8,7 @@
<body><font size="2">
<h3></h3>
<ul>
+ <li>[修改] 修正附件预览可能crash的bug (感谢landice) </li>
<li>[修改] Cmd-L地址栏快捷键 (感谢mephisto) </li>
</ul>
<h3>1.3 Release</h3>
Modified: trunk/XIPreviewController.m
==============================================================================
--- trunk/XIPreviewController.m (original)
+++ trunk/XIPreviewController.m Fri Aug 15 08:27:23 2008
@@ -64,8 +64,9 @@
NSURLRequest *request = [NSURLRequest requestWithURL:URL
cachePolicy:NSURLRequestReturnCacheDataElseLoad
timeoutInterval:30.0];
- XIDownloadDelegate *delegate = [[XIDownloadDelegate new] autorelease];
+ XIDownloadDelegate *delegate = [[XIDownloadDelegate alloc] init];
download = [[NSURLDownload alloc] initWithRequest:request delegate:delegate];
+ [delegate release];
}
if (download == nil)
[[NSWorkspace sharedWorkspace] openURL:URL];
@@ -157,8 +158,10 @@
NSArray *allowedTypes = [NSArray arrayWithObjects:@"jpg", @"jpeg", @"bmp", @"png", @"gif", @"tiff", @"tif", @"pdf", nil];
Boolean canView = [allowedTypes containsObject: fileType];
if (!canView) {
+ [self retain]; // "cancel" may release the delegate
[download cancel];
- [self download:download didFailWithError:nil];
+ [self download:download didFailWithError:nil];
+ [self release];
}
}
@@ -179,7 +182,7 @@
notificationName:@"File Transfer"
isSticky:NO
identifier:download];
- [download autorelease];
+ [download release];
}
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error {
@@ -191,7 +194,7 @@
notificationName:@"File Transfer"
isSticky:NO
identifier:download];
- [download autorelease];
+ [download release];
}
@end