summaryrefslogtreecommitdiff
path: root/new/init_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'new/init_darwin.m')
-rw-r--r--new/init_darwin.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/new/init_darwin.m b/new/init_darwin.m
index c7be20d..b1d88c3 100644
--- a/new/init_darwin.m
+++ b/new/init_darwin.m
@@ -40,6 +40,11 @@
@end
+// we are not in control of the actual lifetimes and refcounts of NSViews (see http://stackoverflow.com/a/29523141/3408572)
+// when we're done with a view, it'll be added as a subview of this one, and this one will be released on application shutdown
+// we need this separate view because it's possible for controls to have no parent but still be alive
+NSView *deletedControlsView;
+
uiInitOptions options;
const char *uiInit(uiInitOptions *o)
@@ -50,6 +55,10 @@ const char *uiInit(uiInitOptions *o)
// see https://github.com/andlabs/ui/issues/6
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp setDelegate:[uiAppDelegate new]];
+
+ // we can use a stock NSView for this
+ deletedControlsView = [[NSView alloc] initWithFrame:NSZeroRect];
+
return NULL;
}