* Source/NSCollectionViewItem.m: Fix reference counting in

-copyWithZone:. Remove method -view again.
        * Source/NSArrayController.m: Fix reference counting in
        -newItemForRepresentedObject. Protect -_resetItemSize from
        missing prototype view.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38392 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2015-03-10 23:02:09 +00:00
parent 5199325e10
commit 6a2ccd78ac
3 changed files with 12 additions and 10 deletions

View file

@ -1,3 +1,11 @@
2015-03-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCollectionViewItem.m: Fix reference counting in
-copyWithZone:. Remove method -view again.
* Source/NSArrayController.m: Fix reference counting in
-newItemForRepresentedObject. Protect -_resetItemSize from missing
prototype view.
2015-03-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCollectionView.m (-tile): Prevent _numberOfColumns from

View file

@ -125,7 +125,7 @@ static NSString *placeholderItem = nil;
- (void) _resetItemSize
{
if (itemPrototype)
if (itemPrototype && ([itemPrototype view] != nil))
{
_itemSize = [[itemPrototype view] frame].size;
_minItemSize = NSMakeSize (_itemSize.width, _itemSize.height);
@ -240,6 +240,7 @@ static NSString *placeholderItem = nil;
}
else
{
[self _resetItemSize];
// Force recalculation of each item's frame
_itemSize = _minItemSize;
_tileWidth = -1.0;
@ -482,7 +483,7 @@ static NSString *placeholderItem = nil;
NSCollectionViewItem *collectionItem = nil;
if (itemPrototype)
{
ASSIGN(collectionItem, [itemPrototype copy]);
collectionItem = [itemPrototype copy];
[collectionItem setRepresentedObject: object];
}
return AUTORELEASE (collectionItem);

View file

@ -101,13 +101,6 @@
ASSIGN(imageView, anImageView);
}
- (NSView *) view
{
// FIXME
[[self textField] setStringValue: [self representedObject]];
return [self textField];
}
- (id) initWithCoder: (NSCoder *)aCoder
{
self = [super initWithCoder: aCoder];
@ -161,7 +154,7 @@
NSData *itemAsData = [NSKeyedArchiver archivedDataWithRootObject: self];
NSCollectionViewItem *newItem =
[NSKeyedUnarchiver unarchiveObjectWithData: itemAsData];
return newItem;
return RETAIN(newItem);
}
@end