From 6701117945b4e633d67529ff052d03123dc5afa7 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Tue, 14 May 2013 14:43:50 -0700 Subject: [PATCH] =?UTF-8?q?Fixed:=20[pasteboard=20declareTypes:=E2=80=A6?= =?UTF-8?q?=20owner:nil];=20would=20emit=20a=20warning.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this fix, declaring a type with a nil owner would cause a "DEPRECATED: object cannot be nil" warning to be issued. This fix now allows a nil owner without warning. --- AppKit/CPPasteboard.j | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/AppKit/CPPasteboard.j b/AppKit/CPPasteboard.j index 0e943dbaa..55dcad9a5 100644 --- a/AppKit/CPPasteboard.j +++ b/AppKit/CPPasteboard.j @@ -191,10 +191,12 @@ var CPPasteboards = nil, _owners = @{}; _provided = @{}; - var count = _types.length; - - while (count--) - [_owners setObject:anOwner forKey:_types[count]]; + if (anOwner) + { + var count = _types.length; + while (count--) + [_owners setObject:anOwner forKey:_types[count]]; + } if (_nativePasteboard && shouldUpdate) { @@ -205,6 +207,7 @@ var CPPasteboards = nil, _nativePasteboard.declareTypes_(nativeTypes); _changeCount = _nativePasteboard.changeCount(); } + return ++_changeCount; }