summaryrefslogtreecommitdiff
path: root/new/newcontrol_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/newcontrol_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/newcontrol_darwin.m')
-rw-r--r--new/newcontrol_darwin.m10
1 files changed, 7 insertions, 3 deletions
diff --git a/new/newcontrol_darwin.m b/new/newcontrol_darwin.m
index 2274190..4586331 100644
--- a/new/newcontrol_darwin.m
+++ b/new/newcontrol_darwin.m
@@ -14,7 +14,7 @@ struct uiSingleViewControl {
static void singleDestroy(uiControl *c)
{
- [S(c)->view release];
+ [S(c)->view removeFromSuperview];
}
static uintptr_t singleHandle(uiControl *c)
@@ -90,7 +90,11 @@ uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHas
return (uiControl *) c;
}
-void uiDarwinControlFree(uiControl *c)
+BOOL uiDarwinControlFreeWhenAppropriate(uiControl *c, NSView *newSuperview)
{
- uiFree(c);
+ if (newSuperview == nil) {
+ uiFree(c);
+ return YES;
+ }
+ return NO;
}