changeset 692:bd909322f40d

Added "retain"s to the DWTree/DWContainer/DWListBox classes memory allocation so the data doesn't get free'd unexpectedly. Fixes crashes in HandyFTP.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 10 Mar 2011 02:34:14 +0000
parents 578bbfd8c904
children 2f21ee9d7c7b
files mac/dw.m
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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];