On 3 Jan 2008, at 8:55 PM, Adam R. Maxwell wrote: > Okay, that's right. There's still a retain cycle in the migration > controller that should be unnecessary. When the document window > closes, it closes the migration window regardless of what it's > doing at the time. >
Why is there a retain cycle? And shouldn't the migration be stopped when the document window closes? Christiaan > On Thursday, January 03, 2008, at 11:47AM, "Christiaan Hofman" > <[EMAIL PROTECTED]> wrote: >> When the migration window may closes it removes it's window >> controller from the document's windowControllers. >> >> Christiaan >> >> On 3 Jan 2008, at 8:43 PM, Adam R. Maxwell wrote: >> >>> This doesn't make sense to me. The document will close all >>> secondary windows and remove window controllers when the main >>> document window closes. Also, if the migrationController is non- >>> nil, it has to be in the window controller list, doesn't it? >>> >>> On Thursday, January 03, 2008, at 11:32AM, >>> <[EMAIL PROTECTED]> wrote: >>>> Revision: 12232 >>>> http://bibdesk.svn.sourceforge.net/bibdesk/? >>>> rev=12232&view=rev >>>> Author: hofman >>>> Date: 2008-01-03 11:32:28 -0800 (Thu, 03 Jan 2008) >>>> >>>> Log Message: >>>> ----------- >>>> Add file migration controller to windowcontrollers when necessary. >>>> Keep a retained reference to the document while migrating. The >>>> controller can be removed from the windowcontrollers and the >>>> document can be reset when the file migration window closes. >>>> >>>> Modified Paths: >>>> -------------- >>>> trunk/bibdesk/BDSKFileMigrationController.m >>>> trunk/bibdesk/BibDocument_Actions.m >>>> >>>> Modified: trunk/bibdesk/BDSKFileMigrationController.m >>>> =================================================================== >>>> --- trunk/bibdesk/BDSKFileMigrationController.m 2008-01-03 >>>> 19:21:00 UTC (rev 12231) >>>> +++ trunk/bibdesk/BDSKFileMigrationController.m 2008-01-03 >>>> 19:32:28 UTC (rev 12232) >>>> @@ -122,6 +122,8 @@ >>>> - (IBAction)migrate:(id)sender; >>>> { >>>> NSMutableArray *observedResults = [self >>>> mutableArrayValueForKey:@"results"]; >>>> + // keep a reference to the document, because it may go away >>>> when the window closes while we're busy >>>> + BibDocument *document = (BibDocument *)[[self document] >>>> retain]; >>>> >>>> // get rid of leftovers from a previous run >>>> [observedResults removeAllObjects]; >>>> @@ -130,9 +132,9 @@ >>>> >>>> NSArray *pubs = nil; >>>> if (useSelection == NO) >>>> - pubs = [[self document] publications]; >>>> + pubs = [document publications]; >>>> else if ([[self document] hasExternalGroupsSelected] == NO) >>>> - pubs = [[self document] selectedPublications]; >>>> + pubs = [document selectedPublications]; >>>> >>>> // Workaround for an AppKit bug in Tiger, the progress bar >>>> does not work after the first time it is used, so we replace it by >>>> a copy. Apparently also in Leopard under some conditions >>>> NSProgressIndicator *newProgressBar = [NSKeyedUnarchiver >>>> unarchiveObjectWithData:[NSKeyedArchiver >>>> archivedDataWithRootObject:progressBar]]; >>>> @@ -186,7 +188,9 @@ >>>> >>>> // BibItem change notifications are only posted if the old >>>> fields are removed, so this ensures that the file view is updated >>>> if (numberOfAddedFiles > 0) >>>> - [[self document] updatePreviews]; >>>> + [document updatePreviews]; >>>> + >>>> + [document release]; >>>> } >>>> >>>> - (IBAction)editPublication:(id)sender; >>>> >>>> Modified: trunk/bibdesk/BibDocument_Actions.m >>>> =================================================================== >>>> --- trunk/bibdesk/BibDocument_Actions.m 2008-01-03 19:21:00 UTC >>>> (rev 12231) >>>> +++ trunk/bibdesk/BibDocument_Actions.m 2008-01-03 19:32:28 UTC >>>> (rev 12232) >>>> @@ -1017,6 +1017,8 @@ >>>> - (IBAction)migrateFiles:(id)sender { >>>> if (nil == migrationController) { >>>> migrationController = [[BDSKFileMigrationController alloc] >>>> init]; >>>> + } >>>> + if ([[self windowControllers] >>>> containsObject:migrationController] == NO) { >>>> [self addWindowController:migrationController]; >>>> } >>>> [migrationController showWindow:self]; >>>> >>>> >>>> This was sent by the SourceForge.net collaborative development >>>> platform, the world's largest Open Source development site. >>>> >>>> ------------------------------------------------------------------- >>>> -- >>>> ---- >>>> This SF.net email is sponsored by: Microsoft >>>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>>> _______________________________________________ >>>> Bibdesk-commit mailing list >>>> [EMAIL PROTECTED] >>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-commit >>>> >>>> >>> >>> -------------------------------------------------------------------- >>> -- >>> --- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> Bibdesk-develop mailing list >>> Bibdesk-develop@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/bibdesk-develop >> >> >> --------------------------------------------------------------------- >> ---- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Bibdesk-develop mailing list >> Bibdesk-develop@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/bibdesk-develop >> >> > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Bibdesk-develop mailing list > Bibdesk-develop@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bibdesk-develop ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Bibdesk-develop mailing list Bibdesk-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-develop