-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory management issue #124
base: master
Are you sure you want to change the base?
Conversation
When the container is added as a subview (https://github.com/indragiek/INAppStoreWindow/blob/master/INAppStoreWindow.m#L965) it's retained by the superview. Could you explain a little bit further about how this crash happens? As far as I can tell, the title bar container is added to a superview as soon as it is created, and is not removed for the entire lifecycle of the window. |
I didn't notice the addSubview. That makes it really weird... The crash only seems to happen on 10.7. This is the crash log:
|
Do you know if explicitly retaining the |
I investigated it a bit more. This is what happens: I'm calling
My hack of retaining the I think the correct solution is this:
However, given that |
Kapeli@1a8a887 seems to fix the moving window issue and memory management issue in 10.7. Please note that you do have other views that you add to the themeFrameView (the window buttons). This means that when the themeFrameView is changed because of a setStyleMask, the buttons should be re-added as well. I don't use the custom buttons so I did not make the changes for those as well as I would not be able to test properly. |
Sorry for not getting back to this sooner, just swamped with other stuff at the moment. You're correct, INAppStoreWindow's handling of |
Is any part of this still relevant now that we are ARC only? |
Probably not. As no one else reported anything I think it's just an issue I'm having. Probably doing something wrong somewhere else. The fix I've applied seems to be ok, so as far as I'm concerned this can be closed. |
Re-adding the title bar container to the theme frame should probably be looked at, though. I have all versions of OS X available so I can test this later if necessary. |
Attempting to toggle NSTexturedBackgroundWindowMask on 10.7 seems to put the window in a totally corrupted state with or without the changes described here. I don't have time to debug this so I simply recommend not calling setStyleMask with NSTexturedBackgroundWindowMask if possible. Even on 10.9 it's quirky. |
_titleBarContainer
does not get retained anywhere, so in manual memory management you end up with anEXC_BAD_ACCESS
waiting to happen in_recalculateFrameForTitleBarContainer
.