Mercurial > dwindows
diff ios/dw.m @ 2817:5000a8a43825
iOS: Fix some memory leaks and remove unnecessary code.
Like on Mac we need to release the item being packed in dw_box_pack_*().
However we don't need the retains or autoreleases since we use ARC on iOS.
The UIWindow release is not necessary, garbage collection will remove it.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 02 Aug 2022 03:07:52 +0000 |
parents | 9c9b680f7772 |
children | d5d09bdd61d6 |
line wrap: on
line diff
--- a/ios/dw.m Mon Aug 01 22:46:31 2022 +0000 +++ b/ios/dw.m Tue Aug 02 03:07:52 2022 +0000 @@ -1871,6 +1871,7 @@ menu = [UIMenu menuWithTitle:@"" children:menuchildren]; } [menu retain]; + [menuchildren release]; if(oldmenu) [oldmenu release]; return menu; @@ -4740,10 +4741,8 @@ /* Add the item to the box */ [view addSubview:this]; - /* Enable autorelease on the item... - * so it will get destroyed when the parent is. - */ - [this autorelease]; + [this release]; + /* If we are packing a button... */ if([this isMemberOfClass:[DWButton class]]) { @@ -9491,10 +9490,6 @@ [_dw_toplevel_windows removeObject:window]; [[[window rootViewController] view] removeFromSuperview]; [window setRootViewController:nil]; - /* Releasing the window is causing crashes.... - * TODO: Figure out if this is needed... or why it is crashing. - * [window release]; - */ } /* Handle removing menu items from menus */ else if([object isMemberOfClass:[DWMenuItem class]])