Remove RETAIN() when returning -[NSPasteboardItem types].

Objective-C memory management policy specifies that methods named with
alloc, new, copy and mutableCopy are the ones that return objects with
refcount 1.

Additionally, `@property (..., copy, ...)` only modifies the setter; the getter
still returns the object as-is. While it should be correct to create
a new immutable object every time, we should not create an object
with refcount 1, but an autoreleased object.
This commit is contained in:
Ivan Vučica 2017-07-31 11:36:15 +01:00 committed by GitHub
parent 4026fbc2be
commit 1cb15c2735
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2017-07-31 Ivan Vucica <ivan@vucica.net>
* Source/NSTextList.m: Add _startingItemNumber-related TODOs to
NSTextList.
* Source/NSPasteboardItem: Remove RETAIN() when returning
-[NSPasteboardItem types].
2017-07-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMenuView.m (-attachSubmenuForItemAtIndex:): We should

View file

@ -48,7 +48,7 @@
- (NSArray *)types
{
return RETAIN([NSArray arrayWithArray: _types]);
return [NSArray arrayWithArray: _types];
}
- (BOOL)setDataProvider:(id<NSPasteboardItemDataProvider>)dataProvider