Re: ObjectController preventing WindowController from releasing
Re: ObjectController preventing WindowController from releasing
- Subject: Re: ObjectController preventing WindowController from releasing
- From: Ken Thomases <email@hidden>
- Date: Mon, 07 Nov 2011 13:16:39 -0600
On Nov 7, 2011, at 11:16 AM, Jonathan Taylor wrote:
> Thanks very much for your reply!
You're welcome.
>> What would you sensibly bind to the File's Owner itself, rather than one of its properties? In other words, what is bound to or through the object controller?
>
> OK, I am not absolutely sure I've understood what you're getting at here, but I will try and answer in two parts - firstly what I originally did, and still do for a number of other windows, followed by the exact situation for this window. It may be that I am doing something wrong in either or both of these, but it may help explain how I've ended up where I have.
>
> == What I originally did ==
>
> The "Content Object" of the ObjectController is bound to "File's Owner.self" and various GUI text boxes are bound to variables within the file's owner e.g. a text box bound to Object Controller.selection.speed. Rightly or wrongly, the data model is contained within the window controller - it really didn't seem worth the effort of separating them out.
>
> Assuming I have set everything up correctly, this was originally suggested to me by a poster on here in order that I could make calls to [myObjectController commitEditing] when I needed to.
>
> == The actual situation for this window ==
>
> I'm not sure if this is what you are getting at here, but actually in this specific case there IS a separation between window controller and data model. The window controller is a very lightweight class which keeps a pointer to the object "camera" that actually contains the data model. So the text boxes are actually bound to things like Object Controller.selection.camera.framerate. Are you suggesting that this could be the problem and I should be binding the Object Controller to File's Owner.camera instead of to File's Owner.self, and that this might help break retain cycles?
Well, in this case I certainly think it would be better to bind the object controller to File's Owner.camera. Really, I wasn't so much getting at anything in particular, I just find it odd for an object controller to have a window controller as its content. I also find it odd to bind to File's Owner.self. I can't say for sure that either is the source of the problem, but they strike me as suspicious.
If your data model is within the window controller and you want a means to use -commitEditing, then you should probably make the window controller conform to NSEditor and NSEditorRegistration, just as NSController (and thus NSObjectController) does.
Regards,
Ken
_______________________________________________
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