Re: Strange controls behaviour in sheet modal window


Quincey Morris
 

On Dec 5, 2017, at 18:55 , Graham Cox <graham@...> wrote:

I’m not sure if there’s a better way to handle it than having a temporary ‘strong’ property for the controller within the client object.

The trouble is, without some more details, it’s not clear what is the boundary between the client and the code module the client is calling into. However, you suggest the window controller is created on the client side of the boundary. If, in addition, the client is passing in a completion handler, you could try wrapping that in your own completion handler, and putting a strong reference to the window controller in your completion handler wrapper.

I haven’t thought this through in great detail, but I don’t think there a reference cycle hidden in that approach, and it should keep the window controller alive until after the action method is executed.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.