Make sure a decoded control always has a cell.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27122 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2008-11-23 17:10:22 +00:00
parent 2f2292f703
commit 9045dcf521
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2008-11-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSControl.m (-initWithCoder:): For keyed decoding make
sure there always is a cell.
2008-11-23 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSTextView.m (-mouseDown:): Allow click into the current

View file

@ -971,7 +971,11 @@ static NSNotificationCenter *nc;
- (id) initWithCoder: (NSCoder*)aDecoder
{
[super initWithCoder: aDecoder];
self = [super initWithCoder: aDecoder];
if (self == nil)
{
return nil;
}
if ([aDecoder allowsKeyedCoding])
{
@ -981,6 +985,15 @@ static NSNotificationCenter *nc;
{
[self setCell: cell];
}
else
{
// This is needed for subclasses without cells, like NSColorWeel
// as we store some properties only on the cell.
NSCell *cell = [[[self class] cellClass] new];
[self setCell: cell];
RELEASE(cell);
}
if ([aDecoder containsValueForKey: @"NSEnabled"])
{
[self setEnabled: [aDecoder decodeBoolForKey: @"NSEnabled"]];