# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1299724454 0 # Node ID bd909322f40d417eed8b65c9d905204e1ab141f8 # Parent 578bbfd8c90452f8660c95701c15bf25c358630c Added "retain"s to the DWTree/DWContainer/DWListBox classes memory allocation so the data doesn't get free'd unexpectedly. Fixes crashes in HandyFTP. diff -r 578bbfd8c904 -r bd909322f40d mac/dw.m --- a/mac/dw.m Tue Mar 08 01:30:04 2011 +0000 +++ b/mac/dw.m Thu Mar 10 02:34:14 2011 +0000 @@ -821,10 +821,10 @@ -(void)clear { if(data) { [data removeAllObjects]; while([titles count]) { [titles removePointerAtIndex:0]; } } lastAddPoint = 0; } -(void)setup { - tvcols = [[NSMutableArray alloc] init]; - data = [[NSMutableArray alloc] init]; - types = [[NSMutableArray alloc] init]; - titles = [NSPointerArray pointerArrayWithWeakObjects]; + tvcols = [[[NSMutableArray alloc] init] retain]; + data = [[[NSMutableArray alloc] init] retain]; + types = [[[NSMutableArray alloc] init] retain]; + titles = [[NSPointerArray pointerArrayWithWeakObjects] retain]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectionChanged:) name:NSTableViewSelectionDidChangeNotification object:[self window]]; } -(void)selectionChanged:(id)sender @@ -981,7 +981,7 @@ children = [parent pointerAtIndex:3]; if(!children) { - children = [[NSMutableArray alloc] init]; + children = [[[NSMutableArray alloc] init] retain]; [parent replacePointerAtIndex:3 withPointer:children]; } } @@ -989,7 +989,7 @@ { if(!data) { - children = data = [[NSMutableArray alloc] init]; + children = data = [[[NSMutableArray alloc] init] retain]; } } [children addObject:item];