diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-10 23:22:46 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-10 23:22:46 -0400 |
| commit | c610c60ea6266fe68c2f06627c0bdbedaa5731bb (patch) | |
| tree | 48d7027b0e11a39cdb8fe2f07fb4e9bf075530ac /new/init_darwin.m | |
| parent | 47c89f6aefcae52301d621634701e7b676487e50 (diff) | |
Started to implement proper destruction logic for Mac OS X controls.
Diffstat (limited to 'new/init_darwin.m')
| -rw-r--r-- | new/init_darwin.m | 9 |
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; } |
