Re: Document being reopened on launch during modal dialog
Re: Document being reopened on launch during modal dialog
- Subject: Re: Document being reopened on launch during modal dialog
- From: "Mills, Steve" <email@hidden>
- Date: Wed, 07 May 2014 22:08:33 +0000
- Thread-topic: Document being reopened on launch during modal dialog
On May 6, 2014, at 19:05:22, Graham Cox <email@hidden> wrote:
> The compromise we've adopted is to let all the documents open as normal *then* show the dialog if necessary on top of them. That avoids the need to capture the 'open' URLs, but it's only OK if you can accept the documents being there - in our case we can. Doing this is fairly simple though - just invoke the dialog opening method after a short delay (1 second in our case) - it's enough to ensure it happens after all doc opening has completed, since the true main event loop runs normally, opens the documents, then processes any pending 'perform after delay' stuff.
I got something working and just wanted to run it by y'all. When the cross-platform init code gets an error, I call a cross-platform function. The Mac build of this function allocates an NSObject subclass and tells it to execute later in the main run loop like so:
RunPlogueModalsInMainEventLoop* runner = [[RunPlogueModalsInMainEventLoop alloc] initForProblem:PlogueProblem::kEngineFailed error:errCode];
[runner performSelectorOnMainThread:@selector(runDlog) withObject:runner waitUntilDone:NO modes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, nil]];
That object's runDlog method then runs our cross-platform dlog and releases the Obj-C object (self):
-(void) runDlog
{
// Simplified for clarity:
fcdlg::PlogueEngineFailError dlg(NULLP, self->error);
dlg.DoModal();
// We're all done with this allocated object:
[self release];
}
Is this all safe and legal, releasing self right before it returns to whatever called it?
--
Steve Mills
office: 952-818-3871
home: 952-401-6255
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden