summaryrefslogtreecommitdiff
path: root/new/button_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-08 15:53:50 -0400
committerPietro Gagliardi <[email protected]>2015-04-08 15:53:50 -0400
commitbb229f9dc110fbc1293be02c71ca4b37b038081e (patch)
tree2c02fee4340f9af429810c6e801df33ae249b270 /new/button_darwin.m
parent25b33c2afd8aa772002f136c2f3bd9d56e22a0ca (diff)
Built up a better system for handling data cleanup on Mac OS X; thanks to http://stackoverflow.com/questions/29522715/is-there-a-reliable-way-to-destroy-private-data-structures-when-a-standard-nsvie.
Diffstat (limited to 'new/button_darwin.m')
-rw-r--r--new/button_darwin.m9
1 files changed, 6 insertions, 3 deletions
diff --git a/new/button_darwin.m b/new/button_darwin.m
index 4173f1c..fb511f7 100644
--- a/new/button_darwin.m
+++ b/new/button_darwin.m
@@ -9,10 +9,13 @@
@implementation uiNSButton
-- (void)dealloc
+- (void)viewDidMoveToSuperview
{
- uiDarwinControlFree(self.uiC);
- [super dealloc];
+ if (uiDarwinControlFreeWhenAppropriate(self.uiC, [self superview])) {
+ [self setTarget:nil];
+ self.uiC = NULL;
+ }
+ [super viewDidMoveToSuperview];
}
- (IBAction)uiButtonClicked:(id)sender