From bfc116b2a4a64662b8c07eaf0053d1b3c7f9ae8b Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 17 Jan 2016 11:51:46 +0200 Subject: [PATCH 1/2] Fixed exit crash on legacy OS X There is no need to close (and thus deallocate) console window explicitly This will be done by autorelease pool in application controller event loop OS X with GC and/or ARC was not affected by this issue Older versions like 10.4 or 10.5 crashed because of double deallocation --- src/posix/cocoa/st_console.h | 1 - src/posix/cocoa/st_console.mm | 5 ----- 2 files changed, 6 deletions(-) diff --git a/src/posix/cocoa/st_console.h b/src/posix/cocoa/st_console.h index 49b6e05470..6b6f018207 100644 --- a/src/posix/cocoa/st_console.h +++ b/src/posix/cocoa/st_console.h @@ -85,7 +85,6 @@ private: int m_netMaxPos; FConsoleWindow(); - ~FConsoleWindow(); void ExpandTextView(float height); diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index 342e251a3f..e952d22d6b 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -118,11 +118,6 @@ FConsoleWindow::FConsoleWindow() [m_window makeKeyAndOrderFront:nil]; } -FConsoleWindow::~FConsoleWindow() -{ - [m_window close]; -} - static FConsoleWindow* s_instance; From 24501dbc93ba866e48416ce9e1d7f918fbf66a8d Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 17 Jan 2016 11:58:44 +0200 Subject: [PATCH 2/2] Fixed copy to pasteboard on legacy OS X Copy/paste is now implemented using the method available on all supported versions This fixes 'unrecognized selector' exception on OS X 10.4 and 10.5 --- src/posix/cocoa/i_system.mm | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index f12ef18eb3..498498d946 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -338,23 +338,17 @@ int I_FindAttr(findstate_t* const fileinfo) } -static NSString* GetPasteboardStringType() -{ -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 - return NSStringPboardType; -#else // 10.6 or higher - return NSAppKitVersionNumber < AppKit10_6 - ? NSStringPboardType - : NSPasteboardTypeString; -#endif // before 10.6 -} - void I_PutInClipboard(const char* const string) { NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard]; - [pasteBoard clearContents]; - [pasteBoard setString:[NSString stringWithUTF8String:string] - forType:GetPasteboardStringType()]; + NSString* const stringType = NSStringPboardType; + NSArray* const types = [NSArray arrayWithObjects:stringType, nil]; + NSString* const content = [NSString stringWithUTF8String:string]; + + [pasteBoard declareTypes:types + owner:nil]; + [pasteBoard setString:content + forType:stringType]; } FString I_GetFromClipboard(bool returnNothing) @@ -365,7 +359,7 @@ FString I_GetFromClipboard(bool returnNothing) } NSPasteboard* const pasteBoard = [NSPasteboard generalPasteboard]; - NSString* const value = [pasteBoard stringForType:GetPasteboardStringType()]; + NSString* const value = [pasteBoard stringForType:NSStringPboardType]; return FString([value UTF8String]); }