-
Notifications
You must be signed in to change notification settings - Fork 111
Conversation
What we really want is a weak reference to the view controller in the view... but I don't think this is possible with associative property. But in addition to that... From "Transitioning to ARC Release Notes":
|
@@ -30,6 +39,11 @@ -(void)setView:(NSView *)view | |||
{ | |||
super.view = view; | |||
self.view.rbl_viewController = self; | |||
|
|||
if (_currentView.rbl_viewController == self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this part. Why not just check self.view
before invoking super
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling self.view before super.view = view would cause an infinit loop.
self.view accessor instantiates loadView or the nib and ends up calling setView.
🚝 |
I only updated the dealloc's curly brace. The reset of the file actually has it on the next line. |
@@ -30,6 +38,11 @@ -(void)setView:(NSView *)view | |||
{ | |||
super.view = view; | |||
self.view.rbl_viewController = self; | |||
|
|||
if (_currentView.rbl_viewController == self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling self.view before super.view = view would cause an infinit loop.
self.view accessor instantiates loadView or the nib and ends up calling setView.
Hmm, very true, but this seems hacky. I don't think I have a better solution right now, though.
Thanks for fixing those up! Just a couple more notes. |
@anozaki was this ready for re-review? We usually leave a top level comment when we're done with a round of changes. |
Yeah, should be ready. |
I'm seeing the effects of this bug, and would love to see this fix merged (even if it's not ideal). |
@jspahrsummers This looks good to me. Any hangups? |
This fell off my radar somehow. Sorry about that! Looks 💎. Thanks! |
Controller/View life cycle fix.
This fixes issue #75, but fixes controller/view life cycle in general.
I was going to attach this request to issue #75 but could not figure it out.