summaryrefslogtreecommitdiff
path: root/new/newcontrol_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-08 03:38:08 -0400
committerPietro Gagliardi <[email protected]>2015-04-08 03:38:08 -0400
commit4ab6251449b4c88869b12514f67c8731ab14c93c (patch)
tree2d732d884cb8a8e4ada340ea423321ff17e35ad3 /new/newcontrol_darwin.m
parent5597606f188833979a7dbcf4a833e55e678f6e82 (diff)
Wrote up cleanup gunk on Mac OS X. Really gunk; I don't like what all this does but I don't think there's another way.
Diffstat (limited to 'new/newcontrol_darwin.m')
-rw-r--r--new/newcontrol_darwin.m10
1 files changed, 10 insertions, 0 deletions
diff --git a/new/newcontrol_darwin.m b/new/newcontrol_darwin.m
index 9b9dd7b..5a346f1 100644
--- a/new/newcontrol_darwin.m
+++ b/new/newcontrol_darwin.m
@@ -13,6 +13,11 @@ struct uiSingleViewControl {
#define S(c) ((uiSingleViewControl *) (c))
+static void singleDestroy(uiControl *c)
+{
+ [S(c)->view release];
+}
+
static uintptr_t singleHandle(uiControl *c)
{
return (uintptr_t) (S(c)->view);
@@ -59,6 +64,7 @@ static void singleResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, i
uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHasBorder, void *data)
{
uiSingleViewControl *c;
+ uiFreeOnDealloc *freer;
c = uiNew(uiSingleViewControl);
// thanks to autoxr and arwyn in irc.freenode.net/#macdev
@@ -79,6 +85,7 @@ uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHas
c->immediate = (NSView *) (c->scrollView);
}
+ c->control.destroy = singleDestroy;
c->control.handle = singleHandle;
c->control.setParent = singleSetParent;
c->control.preferredSize = singlePreferredSize;
@@ -86,6 +93,9 @@ uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHas
c->data = data;
+ freer = (uiFreeOnDealloc *) (c->view);
+ [freer uiFreeOnDealloc:c];
+
return (uiControl *) c;
}