Small keyed decoing improvements.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29963 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2010-03-15 12:55:12 +00:00
parent 93e1163bde
commit 60daf66eb6
5 changed files with 24 additions and 11 deletions

View file

@ -1,3 +1,13 @@
2010-03-15 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCursor.m (-initWithCoder:): Retain self, when using a
predefined cursor.
* Source/NSClipView.m (-initWithCoder:): Undo Greg's hack to
retain the cursor.
* Source/NSView.m (-initWithCoder:),
* Source/NSTextView.m (-initWithCoder:): Small improvements for
keyed decoding.
2010-03-15 Fred Kiefer <FredKiefer@gmx.de> 2010-03-15 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-replaceTextContainer:): Retain self not * Source/NSTextView.m (-replaceTextContainer:): Retain self not

View file

@ -778,8 +778,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
[self setAutoresizesSubviews: YES]; [self setAutoresizesSubviews: YES];
[self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSBGColor"]]; [self setBackgroundColor: [aDecoder decodeObjectForKey: @"NSBGColor"]];
[self setDocumentCursor: [self setDocumentCursor: [aDecoder decodeObjectForKey: @"NSCursor"]];
RETAIN([aDecoder decodeObjectForKey: @"NSCursor"])];
if ([aDecoder containsValueForKey: @"NScvFlags"]) if ([aDecoder containsValueForKey: @"NScvFlags"])
{ {

View file

@ -547,6 +547,7 @@ backgroundColorHint:(NSColor *)bg
// FIXME // FIXME
self = [NSCursor arrowCursor]; self = [NSCursor arrowCursor];
} }
RETAIN(self);
if ([aDecoder containsValueForKey: @"NSHotSpot"]) if ([aDecoder containsValueForKey: @"NSHotSpot"])
{ {

View file

@ -831,6 +831,9 @@ that makes decoding and encoding compatible with the old code.
- (id) initWithCoder: (NSCoder *)aDecoder - (id) initWithCoder: (NSCoder *)aDecoder
{ {
self = [super initWithCoder: aDecoder]; self = [super initWithCoder: aDecoder];
if (!self)
return nil;
if ([aDecoder allowsKeyedCoding]) if ([aDecoder allowsKeyedCoding])
{ {
id textString = nil; id textString = nil;
@ -919,8 +922,9 @@ that makes decoding and encoding compatible with the old code.
if ([aDecoder containsValueForKey: @"NSTVFlags"]) if ([aDecoder containsValueForKey: @"NSTVFlags"])
{ {
[aDecoder decodeIntForKey: @"NSTVFlags"]; //[aDecoder decodeIntForKey: @"NSTVFlags"];
} }
//@"NSDragTypes"
// Don't add the string if it's nil // Don't add the string if it's nil
if(textString != nil) if(textString != nil)

View file

@ -4518,7 +4518,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSArray *subs; NSArray *subs;
// decode the superclass... // decode the superclass...
[super initWithCoder: aDecoder]; self = [super initWithCoder: aDecoder];
if (!self)
return nil;
// initialize these here, since they're needed in either case. // initialize these here, since they're needed in either case.
// _frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame // _frameMatrix = [NSAffineTransform new]; // Map fromsuperview to frame
@ -4545,14 +4547,11 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
} }
// Set bounds rectangle // Set bounds rectangle
if ([aDecoder containsValueForKey: @"NSBounds"])
{
_bounds = [aDecoder decodeRectForKey: @"NSBounds"];
}
else
{
_bounds.origin = NSZeroPoint; _bounds.origin = NSZeroPoint;
_bounds.size = _frame.size; _bounds.size = _frame.size;
if ([aDecoder containsValueForKey: @"NSBounds"])
{
[self setBounds: [aDecoder decodeRectForKey: @"NSBounds"]];
} }
_sub_views = [NSMutableArray new]; _sub_views = [NSMutableArray new];