Commits

Brandon Walkin  committed 263c4f7

Styled Text Field - Really fixed crash/leak issue this time (thanks Trevor Squires and Mike Ash)

  • Participants
  • Parent commits 4dc6763

Comments (0)

Files changed (1)

File BWStyledTextFieldCell.m

 	[coder encodeObject:[self solidColor] forKey:@"BWSTFCSolidColor"];
 } 
 
+- (id)copyWithZone:(NSZone *)zone
+{
+  BWStyledTextFieldCell *cell = (BWStyledTextFieldCell *)[super copyWithZone:zone];
+
+  if (cell)
+  {
+    cell->previousAttributes = [previousAttributes mutableCopy];
+    cell->shadow = [shadow retain];
+    cell->shadowColor = [shadowColor retain];
+    cell->startingColor = [startingColor retain];
+    cell->endingColor = [endingColor retain];
+    cell->solidColor = [solidColor retain];
+  }
+
+  return cell;
+}
+
 - (void)dealloc
 {
-	shadow = nil;
-	previousAttributes = nil;
-	solidColor = nil;
-	endingColor = nil;
-	startingColor = nil;
-	shadowColor = nil;
-	
 	[shadow release];
 	[previousAttributes release];
 	[solidColor release];