# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1659409672 0 # Node ID 5000a8a4382555634bc55619c66ebe0bbef17cb5 # Parent 4521f014bb179c36d7b2917595ef7301a9a530b5 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. diff -r 4521f014bb17 -r 5000a8a43825 ios/dw.m --- 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]])