From: Claudio Cambra Date: Wed, 28 Dec 2022 21:50:58 +0000 (+0100) Subject: Don't bother doing init procedure on FinderSync in macosx shell integration of invali... X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~41^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f7239ebdcaa3c3c8a9130d61fdf3e96f694f3aec;p=nextcloud-desktop.git Don't bother doing init procedure on FinderSync in macosx shell integration of invalid self Signed-off-by: Claudio Cambra --- diff --git a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m index 1da21a9d3..84a124f51 100644 --- a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m +++ b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/FinderSync.m @@ -21,57 +21,59 @@ - (instancetype)init { self = [super init]; - - FIFinderSyncController *syncController = [FIFinderSyncController defaultController]; - NSBundle *extBundle = [NSBundle bundleForClass:[self class]]; - // This was added to the bundle's Info.plist to get it from the build system - NSString *socketApiPrefix = [extBundle objectForInfoDictionaryKey:@"SocketApiPrefix"]; - - NSImage *ok = [extBundle imageForResource:@"ok.icns"]; - NSImage *ok_swm = [extBundle imageForResource:@"ok_swm.icns"]; - NSImage *sync = [extBundle imageForResource:@"sync.icns"]; - NSImage *warning = [extBundle imageForResource:@"warning.icns"]; - NSImage *error = [extBundle imageForResource:@"error.icns"]; - - [syncController setBadgeImage:ok label:@"Up to date" forBadgeIdentifier:@"OK"]; - [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"SYNC"]; - [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"NEW"]; - [syncController setBadgeImage:warning label:@"Ignored" forBadgeIdentifier:@"IGNORE"]; - [syncController setBadgeImage:error label:@"Error" forBadgeIdentifier:@"ERROR"]; - [syncController setBadgeImage:ok_swm label:@"Shared" forBadgeIdentifier:@"OK+SWM"]; - [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"SYNC+SWM"]; - [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"NEW+SWM"]; - [syncController setBadgeImage:warning label:@"Ignored" forBadgeIdentifier:@"IGNORE+SWM"]; - [syncController setBadgeImage:error label:@"Error" forBadgeIdentifier:@"ERROR+SWM"]; - - // The Mach port name needs to: - // - Be prefixed with the code signing Team ID - // - Then infixed with the sandbox App Group - // - The App Group itself must be a prefix of (or equal to) the application bundle identifier - // We end up in the official signed client with: 9B5WD74GWJ.com.owncloud.desktopclient.socket - // With ad-hoc signing (the '-' signing identity) we must drop the Team ID. - // When the code isn't sandboxed (e.g. the OC client or the legacy overlay icon extension) - // the OS doesn't seem to put any restriction on the port name, so we just follow what - // the sandboxed App Extension needs. - // https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24 - - NSURL *container = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:socketApiPrefix]; - NSURL *socketPath = [container URLByAppendingPathComponent:@".socket" isDirectory:NO]; - - NSLog(@"Socket path: %@", socketPath.path); - - if (socketPath.path) { - self.lineProcessor = [[LineProcessor alloc] initWithDelegate:self]; - self.localSocketClient = [[LocalSocketClient alloc] init:socketPath.path - lineProcessor:self.lineProcessor]; - [self.localSocketClient start]; - } else { - NSLog(@"No socket path. Not initiating local socket client."); - self.localSocketClient = nil; + + if (self) { + FIFinderSyncController *syncController = [FIFinderSyncController defaultController]; + NSBundle *extBundle = [NSBundle bundleForClass:[self class]]; + // This was added to the bundle's Info.plist to get it from the build system + NSString *socketApiPrefix = [extBundle objectForInfoDictionaryKey:@"SocketApiPrefix"]; + + NSImage *ok = [extBundle imageForResource:@"ok.icns"]; + NSImage *ok_swm = [extBundle imageForResource:@"ok_swm.icns"]; + NSImage *sync = [extBundle imageForResource:@"sync.icns"]; + NSImage *warning = [extBundle imageForResource:@"warning.icns"]; + NSImage *error = [extBundle imageForResource:@"error.icns"]; + + [syncController setBadgeImage:ok label:@"Up to date" forBadgeIdentifier:@"OK"]; + [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"SYNC"]; + [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"NEW"]; + [syncController setBadgeImage:warning label:@"Ignored" forBadgeIdentifier:@"IGNORE"]; + [syncController setBadgeImage:error label:@"Error" forBadgeIdentifier:@"ERROR"]; + [syncController setBadgeImage:ok_swm label:@"Shared" forBadgeIdentifier:@"OK+SWM"]; + [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"SYNC+SWM"]; + [syncController setBadgeImage:sync label:@"Synchronizing" forBadgeIdentifier:@"NEW+SWM"]; + [syncController setBadgeImage:warning label:@"Ignored" forBadgeIdentifier:@"IGNORE+SWM"]; + [syncController setBadgeImage:error label:@"Error" forBadgeIdentifier:@"ERROR+SWM"]; + + // The Mach port name needs to: + // - Be prefixed with the code signing Team ID + // - Then infixed with the sandbox App Group + // - The App Group itself must be a prefix of (or equal to) the application bundle identifier + // We end up in the official signed client with: 9B5WD74GWJ.com.owncloud.desktopclient.socket + // With ad-hoc signing (the '-' signing identity) we must drop the Team ID. + // When the code isn't sandboxed (e.g. the OC client or the legacy overlay icon extension) + // the OS doesn't seem to put any restriction on the port name, so we just follow what + // the sandboxed App Extension needs. + // https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24 + + NSURL *container = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:socketApiPrefix]; + NSURL *socketPath = [container URLByAppendingPathComponent:@".socket" isDirectory:NO]; + + NSLog(@"Socket path: %@", socketPath.path); + + if (socketPath.path) { + self.lineProcessor = [[LineProcessor alloc] initWithDelegate:self]; + self.localSocketClient = [[LocalSocketClient alloc] init:socketPath.path + lineProcessor:self.lineProcessor]; + [self.localSocketClient start]; + } else { + NSLog(@"No socket path. Not initiating local socket client."); + self.localSocketClient = nil; + } + _registeredDirectories = [[NSMutableSet alloc] init]; + _strings = [[NSMutableDictionary alloc] init]; + _menuIsComplete = [[NSCondition alloc] init]; } - _registeredDirectories = [[NSMutableSet alloc] init]; - _strings = [[NSMutableDictionary alloc] init]; - _menuIsComplete = [[NSCondition alloc] init]; return self; }