[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnustep-gui and blocks support

From: Luboš Doležel
Subject: Re: gnustep-gui and blocks support
Date: Thu, 20 Jun 2013 23:24:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

OK, so except for AUTORELEASE(controller) it would work well. I
obviously have to RELEASE() the controller only when the dialog is

I've also found out how you maintain ABI compatibility when adding
ivars. The same way as it's typically done in C++.

But I also need to use Block_copy (and Block_release) when copying the
block to self, since beginWithCompletionHandler is asynchronous.

I haven't found a macro/solution for these calls. How to deal with that?


On 06/20/2013 05:24 PM, Luboš Doležel wrote:
> Great, now I have a general question about NSSavePanel. I'd like
> to contribute so much, but I'm very far from proficient at AppKit
> :-(
> - (void)beginWithCompletionHandler:(void (^)(NSInteger
> result))handler
> starts a modeless window. My idea would be to save the handler into
> an instance variable and do this:
> NSWindowController *controller = [[NSWindowController alloc] 
> initWithWindow: self]; self->completionHandler = handler; 
> [controller showWindow: self]; AUTORELEASE(controller);
> Then, in -cancel and -ok check whether we were run modally or
> modelessly (by checking if we have a completion handler) and either
> call
> [NSApp stopModalWithCode: code];
> as it is now, or
> CALL_BLOCK(completionHandler, code);
> Another problem I need some help with is avoiding fragile ABI
> breakage.
> Luboš
> On Thu, 20 Jun 2013 16:10:55 +0100, David Chisnall wrote:
>> Yup, looks good to me,
>> David

reply via email to

[Prev in Thread] Current Thread [Next in Thread]