From 8ce413fa31c0534d6055044aa19f026347320cd1 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 11 Sep 2015 18:46:43 -0700 Subject: [PATCH] Mac scr: revert to using Objective-C Garbage Collection instead of Automatic Reference Counting, for compatibility with OS 10.6 and OS 10.7, which require GC in screensavers. It is still compatible with OS 10.8 through OS 10.11. This requires building with Xcode 5 or earlier, because Xcode 6 forces converting to ARC. --- clientscr/Mac_Saver_ModuleView.m | 17 +++++++++++------ mac_build/boinc.xcodeproj/project.pbxproj | 8 ++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/clientscr/Mac_Saver_ModuleView.m b/clientscr/Mac_Saver_ModuleView.m index 55c21abde3..7546baab18 100644 --- a/clientscr/Mac_Saver_ModuleView.m +++ b/clientscr/Mac_Saver_ModuleView.m @@ -53,6 +53,7 @@ int gBlankingTime; // Delay in minutes before blanking the screen NSString *gPathToBundleResources = NULL; NSString *mBundleID = NULL; // our bundle ID NSImage *gBOINC_Logo = NULL; +NSImage *gPreview_Image = NULL; int gTopWindowListIndex = -1; @@ -253,12 +254,16 @@ int signof(float x) { if ([ self isPreview ]) { #if 1 // Currently drawRect just draws our logo in the preview window - NSString *fileName = [[ NSBundle bundleForClass:[ self class ]] pathForImageResource:@"boinc" ]; - if (fileName) { - NSImage *myImage = [[ NSImage alloc ] initWithContentsOfFile:fileName ]; - [ myImage setScalesWhenResized:YES ]; - [ myImage setSize:theFrame.size ]; - [ myImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 ]; + if (gPreview_Image == NULL) { + NSString *fileName = [[ NSBundle bundleForClass:[ self class ]] pathForImageResource:@"boinc" ]; + if (fileName) { + gPreview_Image = [[ NSImage alloc ] initWithContentsOfFile:fileName ]; + } + } + if (gPreview_Image) { + [ gPreview_Image setScalesWhenResized:YES ]; + [ gPreview_Image setSize:theFrame.size ]; + [ gPreview_Image drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 ]; } [ self setAnimationTimeInterval:1/1.0 ]; #else // Code for possible future use if we want to draw more in preview diff --git a/mac_build/boinc.xcodeproj/project.pbxproj b/mac_build/boinc.xcodeproj/project.pbxproj index 4dca697854..9a5ebbbbdf 100755 --- a/mac_build/boinc.xcodeproj/project.pbxproj +++ b/mac_build/boinc.xcodeproj/project.pbxproj @@ -3863,8 +3863,8 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - CLANG_ENABLE_OBJC_ARC = YES; - GCC_ENABLE_OBJC_GC = unsupported; + CLANG_ENABLE_OBJC_ARC = NO; + GCC_ENABLE_OBJC_GC = supported; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "ScreenSaver-Info.plist"; OTHER_LDFLAGS = ( @@ -4035,8 +4035,8 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - CLANG_ENABLE_OBJC_ARC = YES; - GCC_ENABLE_OBJC_GC = unsupported; + CLANG_ENABLE_OBJC_ARC = NO; + GCC_ENABLE_OBJC_GC = supported; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "ScreenSaver-Info.plist"; OTHER_LDFLAGS = (