From d31d14ccc4b5b25610e6b7355f299fd748ad4e9e Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Mon, 31 Aug 2009 23:22:09 -0400 Subject: [PATCH] Retain the plugin manager so we can make sure to clean up after any callbacks, even if Aperture cancels the export. --- ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.m b/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.m index bc7446f52..b4dd7f0a6 100644 --- a/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.m +++ b/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.m @@ -260,17 +260,17 @@ NSString * const TURAnselServerPasswordKey = @"password"; imageDataDict, @"data", [NSNumber numberWithBool:NO], @"default", nil]; -// + //Start upload with current gallery. NSLog(@"Uploading photo %d out of %d", index, [_exportManager imageCount]); + + // Make sure we are around for all callbacks to return even if Aperture cancelled. + [self retain]; [_currentGallery uploadImageObject: params]; [keys release]; [values release]; [imageDataDict release]; - //[metadata release]; [params release]; - //[iptcDict release]; - return NO; } @@ -352,6 +352,7 @@ NSString * const TURAnselServerPasswordKey = @"password"; // and update the UI. - (void)TURAnselDidInitialize { + [self release]; NSLog(@"TURAnselDidInitialize"); [galleryCombo reloadData]; [galleryCombo setEnabled: true]; @@ -365,6 +366,7 @@ NSString * const TURAnselServerPasswordKey = @"password"; //@TODO - need to add a flag to indicate if we have a UI or not - (void)TURAnselHadError: (NSError *)error { + [self release]; NSLog(@"TURAnselHadError"); // Stop the spinner [spinner stopAnimation: self]; @@ -614,6 +616,7 @@ NSString * const TURAnselServerPasswordKey = @"password"; // Start the connection process. -(void)doConnect { + [self retain]; [galleryCombo deselectItemAtIndex: [galleryCombo indexOfSelectedItem]]; [mServersPopUp setEnabled: NO]; [mNewGalleryButton setEnabled: NO]; -- 2.11.0