i have written an Titanium iOS Module for streaming audio.
On iPhone 5s and above the app and the module is running great.
The problem is every time the stopStream function is called in my app on an iPhone 5 or lower the app crashes.
I think there is a memory leak or something but i doesnt find the solution for that problem.
Here is my module code:
//THIS FUNCTION THET STARTS THE STREAM. THERE IS NO PROBLEM ON THE IPHONE 5
-(id)startStream:(id)args
{
ENSURE_SINGLE_ARG(args,NSString);
NSURL *url = [NSURL URLWithString:args];
playerItem = [AVPlayerItem playerItemWithURL:url];
[playerItem addObserver:self forKeyPath:#"timedMetadata" options:NSKeyValueObservingOptionNew context:nil];
player = [[AVPlayer playerWithPlayerItem:playerItem] retain];
[player addObserver:self forKeyPath:#"status" options:0 context:nil];
[player play];
[self fireEvent:#"START" withObject:nil];
NSLog(#"[INFO] player item error : %#", playerItem.error.description);
NSLog(#"[INFO] player error : %#", player.error.description);
return args;
}
//THIS IS THE FUNCTION WHERE MY APP CRASH ON IPHONE 5
-(id)stopStream:(id)args
{
NSLog(#"[INFO]AVPlayer STOP");
[player pause];
[playerItem removeObserver:self forKeyPath:#"timedMetadata" context:nil];
[player removeObserver:self forKeyPath:#"status" context:nil];
player=nil;
}
Here an part of the device log.
296 00:43:40 W TestApp[3487] <Warning>: [INFO]AVPlayer STOP
297 00:43:40 E ReportCrash[3490] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)
301 00:43:40 W mediaserverd[37] <Warning>: 00:43:40.969 [0x3257000] CMSession retain count > 1!
306 00:43:41 W SpringBoard[43] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
307 00:43:41 W SpringBoard[43] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
308 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3483: No such process
309 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3487: No such process
310 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3487: No such process
311 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3487: No such process
312 00:43:41 E ReportCrash[3490] <Error>: Not saving crash log because we have reached the limit for logs to store on disk. Sync or otherwise clear logs from /var/mobile/Library/Logs/CrashReporter to save new logs.
313 00:43:41 E ReportCrash[3490] <Error>: Could not save crash report to disk!
314 00:43:41 W SpringBoard[43] <Warning>: Application 'UIKitApplication:com.fpmsoft.isa.TestApp[0x476c]' crashed.
315 00:43:41 W assertiond[58] <Warning>: pid_suspend failed for <BKNewProcess: 0x14d90e90; com.fpmsoft.isa.TestApp; pid: 3487; hostpid: -1>: Unknown error: -1, Unknown error: -1
316 00:43:41 W assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x14d90e90; com.fpmsoft.isa.TestApp; pid: 3487; hostpid: -1> to 2, priority: No such process
317 00:43:41 W assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x14d90e90; com.fpmsoft.isa.TestApp; pid: 3487; hostpid: -1> to 4096, priority: No such process
318 00:43:41 W UserEventAgent[17] <Warning>: id=com.fpmsoft.isa.TestApp pid=3487, state=0
319 00:43:41 E ReportCrash[3490] <Error>: Incident Identifier: 5CF594F7-3628-4EAE-88D6-B6AA4DC4C028
320 00:43:41 E ReportCrash[3490] <Error>: CrashReporter Key: 509d7f4d78bbd031f5bf1a6ef122f14f5be24f8b
321 00:43:41 E ReportCrash[3490] <Error>: Hardware Model: iPhone5,2
322 00:43:41 E ReportCrash[3490] <Error>: Process: TestApp [3487]
323 00:43:41 E ReportCrash[3490] <Error>: Path: /private/var/mobile/Containers/Bundle/Application/78A7A4DB-3377-4875-B86F-217F1B8DFF9E/TestApp.app/TestApp
324 00:43:41 E ReportCrash[3490] <Error>: Identifier: TestApp
325 00:43:41 E ReportCrash[3490] <Error>: Version: ???
326 00:43:41 E ReportCrash[3490] <Error>: Code Type: ARM (Native)
327 00:43:41 E ReportCrash[3490] <Error>: Parent Process: launchd [1]
328 00:43:41 E ReportCrash[3490] <Error>: Date/Time: 2015-09-13 00:43:40.855 +0200
329 00:43:41 E ReportCrash[3490] <Error>: Launch Time: 2015-09-13 00:43:34.825 +0200
330 00:43:41 E ReportCrash[3490] <Error>: OS Version: iOS 8.3 (12F70)
331 00:43:41 E ReportCrash[3490] <Error>: Report Version: 105
332 00:43:41 E ReportCrash[3490] <Error>: Exception Type: EXC_BAD_ACCESS (SIGSEGV)
333 00:43:41 E ReportCrash[3490] <Error>: Exception Subtype: KERN_INVALID_ADDRESS at 0x9805ac14
334 00:43:41 E ReportCrash[3490] <Error>: Triggered by Thread: 6
335 00:43:41 E ReportCrash[3490] <Error>: Thread 0 name: Dispatch queue: com.apple.main-thread
336 00:43:41 E ReportCrash[3490] <Error>: Thread 0:
337 00:43:41 E ReportCrash[3490] <Error>: 0 libsystem_kernel.dylib 0x359b1474 0x359b0000 + 5236
338 00:43:41 E ReportCrash[3490] <Error>: 1 libsystem_kernel.dylib 0x359b1268 0x359b0000 + 4712
339 00:43:41 E ReportCrash[3490] <Error>: 2 CoreFoundation 0x2708256e 0x26fb5000 + 841070
340 00:43:41 E ReportCrash[3490] <Error>: 3 CoreFoundation 0x27080b14 0x26fb5000 + 834324
341 00:43:41 E ReportCrash[3490] <Error>: 4 CoreFoundation 0x26fcd1fc 0x26fb5000 + 98812
342 00:43:41 E ReportCrash[3490] <Error>: 5 CoreFoundation 0x26fcd00e 0x26fb5000 + 98318
343 00:43:41 E ReportCrash[3490] <Error>: 6 GraphicsServices 0x2e8ac1fc 0x2e8a3000 + 37372
344 00:43:41 E ReportCrash[3490] <Error>: 7 UIKit 0x2a771a54 0x2a702000 + 457300
345 00:43:41 E ReportCrash[3490] <Error>: 8 TestApp 0x00024ca2 0x20000 + 19618
346 00:43:41 E ReportCrash[3490] <Error>: 9 libdyld.dylib 0x358faaac 0x358f9000 + 6828
347 00:43:41 E ReportCrash[3490] <Error>: Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
348 00:43:41 E ReportCrash[3490] <Error>: Thread 1:
349 00:43:41 E ReportCrash[3490] <Error>: 0 libsystem_kernel.dylib 0x359b1224 0x359b0000 + 4644
350 00:43:41 E ReportCrash[3490] <Error>: 1 libdispatch.dylib 0x358e60ec 0x358d8000 + 57580
351 00:43:41 E ReportCrash[3490] <Error>: 2 libdispatch.dylib 0x358dad36 0x358d8000 + 11574
352 00:43:41 E ReportCrash[3490] <Error>: Thread 2 name: Dispatch queue: com.appcelerator.anlaytics.databaseQueue
353 00:43:41 E ReportCrash[3490] <Error>: Thread 2:
354 00:43:41 E ReportCrash[3490] <Error>: 0 libsystem_kernel.dylib 0x359b14c4 0x359b0000 + 5316
355 00:43:41 E ReportCrash[3490] <Error>: 1 libdispatch.dylib 0x358e45da 0x358d8000 + 50650
356 00:43:41 E ReportCrash[3490] <Error>: 2 CFNetwork 0x26b50c6c 0x26aef000 + 400492
357 00:43:41 E ReportCrash[3490] <Error>: 3 CFNetwork 0x26b6bd3a 0x26aef000 + 511290
358 00:43:41 E ReportCrash[3490] <Error>: 4 TestApp 0x00374bbc 0x20000 + 3492796
359 00:43:41 E ReportCrash[3490] <Error>: 5 TestApp 0x0036c1d2 0x20000 + 3457490
360 00:43:41 E ReportCrash[3490] <Error>: 6 libdispatch.dylib 0x358e0a38 0x358d8000 + 35384
361 00:43:41 E ReportCrash[3490] <Error>: 7 TestApp 0x0036bdaa 0x20000 + 3456426
362 00:43:41 E ReportCrash[3490] <Error>: 8 libdispatch.dylib 0x358d92cc 0x358d8000 + 4812
i found the solution for my problem.
i must add an return in the function.
Now it is working for iPhone5 and lower
-(id)stopStream:(id)args
{
NSLog(#"[INFO]AVPlayer STOP");
[player pause];
[playerItem removeObserver:self forKeyPath:#"timedMetadata" context:nil];
[player removeObserver:self forKeyPath:#"status" context:nil];
return args;
}
You're also over retaining the player. You should [player release]; in your stopStream, or in startStream, only instantiate a new player if one does not already exist.
Related
I was trying to test app that works fine on Mojave but keeps crashing on Catalina. I am providing the crash details below for any help.What could be the reason for it to not work on Catalina?
I was trying to test app that works fine on Mojave but keeps crashing on Catalina. I am providing the crash details below for any help.What could be the reason for it to not work on Catalina?
Process: SSWatcher [9887]
Path: /Library/Application Support/safe/MacOS/SSWatcher
Identifier: com.safe.sswatcher
Version: 1.0
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: SSWatcher [9887]
User ID: 501
Date/Time: 2019-09-18 16:02:08.870 +0800
OS Version: Mac OS X 10.15 (19A558d)
Report Version: 12
Anonymous UUID: 75520E05-90C3-B100-E7E3-3AE1B6910181
Sleep/Wake UUID: 551DFEAF-E97E-42BB-9610-A525913A821B
Time Awake Since Boot: 6900 seconds
Time Since Wake: 4600 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
terminating with uncaught exception of type NSException
abort() called
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff396d8033 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff6f6e6bd4 objc_exception_throw + 48
2 CoreFoundation 0x00007fff3979adda _CFThrowFormattedException + 202
3 CoreFoundation 0x00007fff39798dc0 -[__NSArrayM insertObject:atIndex:].cold.2 + 0
4 CoreFoundation 0x00007fff39618811 -[__NSArrayM insertObject:atIndex:] + 1255
5 SSWatcher 0x000000010d1a5314 -[DNCurrentWindow SetFrontMostWindow] + 1540
6 SSWatcher 0x000000010d1a3e15 _Z29InstallSSWatcherEventHandlersv + 85
7 SSWatcher 0x000000010d1a9111 -[DNMainController awakeFromNib] + 545
8 CoreFoundation 0x00007fff3968d735 -[NSSet makeObjectsPerformSelector:] + 231
9 AppKit 0x00007fff36855e8c -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 1485
10 AppKit 0x00007fff36853eaf loadNib + 401
11 AppKit 0x00007fff3685345e +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
12 AppKit 0x00007fff368530b4 -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
13 AppKit 0x00007fff36852e8d +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 446
14 AppKit 0x00007fff368490b6 NSApplicationMain + 505
15 SSWatcher 0x000000010d1a37e2 main + 34
16 libdyld.dylib 0x00007fff70a452a5 start + 1
17 ??? 0x0000000000000001 0x0 + 1
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff70b942aa __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff70c51707 pthread_kill + 384
2 libsystem_c.dylib 0x00007fff70b1ca08 abort + 120
3 libc++abi.dylib 0x00007fff6dbe8bc8 abort_message + 231
4 libc++abi.dylib 0x00007fff6dbe8d7c demangling_terminate_handler() + 262
5 libobjc.A.dylib 0x00007fff6f6e8aaa _objc_terminate() + 96
6 libc++abi.dylib 0x00007fff6dbf5da7 std::__terminate(void (*)()) + 8
7 libc++abi.dylib 0x00007fff6dbf5b55 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 27
8 libc++abi.dylib 0x00007fff6dbe734f __cxa_throw + 113
9 libobjc.A.dylib 0x00007fff6f6e6d02 objc_exception_throw + 350
10 com.apple.CoreFoundation 0x00007fff3979adda _CFThrowFormattedException + 202
11 com.apple.CoreFoundation 0x00007fff39798dc0 -[__NSArrayM insertObject:atIndex:].cold.1 + 35
12 com.apple.CoreFoundation 0x00007fff39618811 -[__NSArrayM insertObject:atIndex:] + 1255
13 com.esafe.sswatcher 0x000000010d1a5314 -[DNCurrentWindow SetFrontMostWindow] + 1540
14 com.esafe.sswatcher 0x000000010d1a3e15 InstallSSWatcherEventHandlers() + 85
15 com.esafe.sswatcher 0x000000010d1a9111 -[DNMainController awakeFromNib] + 545
16 com.apple.CoreFoundation 0x00007fff3968d735 -[NSSet makeObjectsPerformSelector:] + 231
17 com.apple.AppKit 0x00007fff36855e8c -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 1485
18 com.apple.AppKit 0x00007fff36853eaf loadNib + 401
19 com.apple.AppKit 0x00007fff3685345e +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
20 com.apple.AppKit 0x00007fff368530b4 -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
21 com.apple.AppKit 0x00007fff36852e8d +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 446
22 com.apple.AppKit 0x00007fff368490b6 NSApplicationMain + 505
23 com.esafe.sswatcher 0x000000010d1a37e2 main + 34
24 libdyld.dylib 0x00007fff70a452a5 start + 1
Thread 1:
0 libsystem_pthread.dylib 0x00007fff70c4e5b4 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x00007fff70c4e5b4 start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x00007fff70c4e5b4 start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x00007fff70c4e5b4 start_wqthread + 0
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000118023d40 rcx: 0x00007ffee2a5b8f8 rdx: 0x0000000000000000
rdi: 0x0000000000000307 rsi: 0x0000000000000006 rbp: 0x00007ffee2a5b920 rsp: 0x00007ffee2a5b8f8
r8: 0x00007ffee2a5b7c0 r9: 0x00007ffee2a5b990 r10: 0x0000000000000000 r11: 0x0000000000000246
r12: 0x0000000000000307 r13: 0x0000003000000008 r14: 0x0000000000000006 r15: 0x0000000000000016
rip: 0x00007fff70b942aa rfl: 0x0000000000000246 cr2: 0x00007fff9d6a7628
Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133
Hope the details are enough
I got a crash relate AVSpeechSynthersizer. and my code is,
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:text];
utterance.rate = rate;
utterance.pitchMultiplier = pitchMultiplier;
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:languageCode];
_startTime = [[NSDate date] timeIntervalSince1970];
[self.speechSynthesizer speakUtterance:utterance];
There is only one user case this crash. OS version is 11.4, device is iPhone6.
crash stack info:
Incident Identifier: 24E003DC-47C0-45B0-A22E-A351B2A8046A
CrashReporter Key: c8844c975fe64b90aad2b813254959a928e4c4ea
Hardware Model: iPhone7,2
Process: qcs.r [779]
Path: /var/containers/Bundle/Application/0242C042-0AE5-4033-AE07-D1BECD6DD910/qcs.r.app/qcs.r
Identifier: com.meituan.qcs.r.ios
Version: 2.1.9 (1682)
Code Type: ARM-64
Parent Process: ? [1]
Date/Time: 2018-06-14 13:41:58.000 +0800
OS Version: iOS 11.4 (15F79)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x0000000000000000
Crashed Thread: 53
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString
UserInfo:(null)'
Thread 53 Crashed:
0 CoreFoundation __exceptionPreprocess+ 228
1 libobjc.A.dylib objc_exception_throw (in libobjc.A.dylib) + 56
2 CoreFoundation -[NSException initWithCoder:]+ 0
3 Foundation +[NSString stringWithUTF8String:]+ 92
4 TTSSpeechBundle 0x0000000105f87544 0x105f70000 + 95556
5 libsystem_pthread.dylib _pthread_body (in libsystem_pthread.dylib) + 272
6 libsystem_pthread.dylib _pthread_body (in libsystem_pthread.dylib) + 0
7 libsystem_pthread.dylib thread_start (in libsystem_pthread.dylib) + 4
Could your text argument here be nil by any chance? initWithString:text
code :
- (void)stopCurrentSessionFromSuite:(NSNotification*)notification{
isCloseCurrentSession = YES;
dispatch_async(self.dataSendingQueue, ^{
CARD8 messageToDisableSession = rpcHostDisableMsg;
[readerNwriter writeExact:(char*)&messageToDisableSession ofLenght:sizeof(CARD8) secApplied:NO];
});
[rpcCaptureMgr stopCaptureSession];
}
Crash :
Time Awake Since Boot: 1400 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x0000000000000070 Exception Note:
EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11 Termination Reason:
Namespace SIGNAL, Code 0xb Terminating Process: exc handler [0]
VM Regions Near 0x70:
-->
__TEXT 000000010871a000-000000010873a000 [ 128K] r-x/rwx SM=COW
/Applications/RemotePCSuite/*/RemotePCDesktop.app/Contents/MacOS/RemotePCDesktop
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0
libdispatch.dylib 0x00007fff72de50db
_dispatch_continuation_async + 5 1 com.prosoftnet.remotepcDesktop 0x0000000108727fd5
-[RPCDesktopAppDelegate stopCurrentSessionFromSuite:] + 104 2 com.apple.CoreFoundation 0x00007fff4b7a333c
CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12 3 com.apple.CoreFoundation 0x00007fff4b7a32cf
_CFXRegistrationPost_block_invoke + 63 4 com.apple.CoreFoundation 0x00007fff4b7ab92c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12 5
com.apple.CoreFoundation 0x00007fff4b78e8a3 __CFRunLoopDoBlocks
+ 275 6 com.apple.CoreFoundation 0x00007fff4b78e668 __CFRunLoopRun + 3128 7 com.apple.CoreFoundation 0x00007fff4b78d797 CFRunLoopRunSpecific + 487 8 com.apple.HIToolbox
0x00007fff4aaa2866 RunCurrentEventLoopInMode + 286 9
com.apple.HIToolbox 0x00007fff4aaa25d6
ReceiveNextEventCommon + 613 10 com.apple.HIToolbox
0x00007fff4aaa2354 _BlockUntilNextEventMatchingListInModeWithFilter +
64 11 com.apple.AppKit 0x00007fff48d9fa23 _DPSNextEvent
+ 2085 12 com.apple.AppKit 0x00007fff49534e6c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044 13 com.apple.AppKit 0x00007fff48d94831 -[NSApplication run]
+ 764 14 com.apple.AppKit 0x00007fff48d639d2 NSApplicationMain + 804 15 libdyld.dylib
0x00007fff72e0c145 start + 1
I have integrated CEF Framework into my project.
Its working fine for mouse based window close but it crashes If I use inbuilt touch pad of mac book pro while closing browser pop up window.
The pop up window is generate by CEF.
I am able to reproduce the crash like above most of the times.
Here is the crash log
Process: cefclient [1271] Path:
/Users/USER/Documents/*/cefclient.app/Contents/MacOS/cefclient
Identifier: com.genband.omni.mac Version:
1.0.0.30 (1.0.0.30) Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: cefclient [1271] User
ID: 501
Date/Time: 2016-07-07 14:54:14.865 +0530 OS Version:
Mac OS X 10.10.2 (14C1514) Report Version: 11 Anonymous UUID:
0F54FCED-4D82-FEB9-5CD2-3A541BF3C022
Sleep/Wake UUID: C774E441-04B7-4295-A913-3AD622E6B6F3
Time Awake Since Boot: 4300 seconds Time Since Wake: 710 seconds
Crashed Thread: 0 CrBrowserMain Dispatch queue:
com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x0000443e46cfbec0
VM Regions Near 0x443e46cfbec0:
mapped file 0000000124936000-0000000124b36000 [ 2048K] rw-/rwx SM=ALI /private/var/folders//.3KjSNY
-->
MALLOC_NANO 0000600000000000-0000600000200000 [ 2048K] rw-/rwx SM=PRV
Application Specific Information: objc_msgSend() selector name:
respondsToSelector: Performing #selector(_close:) from sender
_NSThemeCloseWidget 0x608000186320
Thread 0 Crashed:: CrBrowserMain Dispatch queue:
com.apple.main-thread 0 libobjc.A.dylib
0x00007fff9303f0dd objc_msgSend + 29 1 com.apple.AppKit
0x00007fff87802735 -[NSWindow close] + 312 2 libsystem_trace.dylib
0x00007fff84178cd7 _os_activity_initiate + 75 3 com.apple.AppKit
0x00007fff877b9b71 -[NSApplication sendAction:to:from:] + 452 4
com.apple.AppKit 0x00007fff877b9970 -[NSControl
sendAction:to:] + 86 5 com.apple.AppKit
0x00007fff8798f86c __26-[NSCell _sendActionFrom:]_block_invoke + 131 6
libsystem_trace.dylib 0x00007fff84178cd7
_os_activity_initiate + 75 7 com.apple.AppKit 0x00007fff87802509 -[NSCell _sendActionFrom:] + 144 8
libsystem_trace.dylib 0x00007fff84178cd7
_os_activity_initiate + 75 9 com.apple.AppKit 0x00007fff87801d66 -[NSButtonCell performClick:] + 1027 10
com.apple.Foundation 0x00007fff83eaecdc
__NSThreadPerformPerform + 293 11 com.apple.CoreFoundation 0x00007fff90285681
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 12 com.apple.CoreFoundation 0x00007fff902778dc
__CFRunLoopDoSources0 + 476 13 com.apple.CoreFoundation 0x00007fff90276e3f __CFRunLoopRun + 927 14 com.apple.CoreFoundation
0x00007fff90276858 CFRunLoopRunSpecific + 296 15 com.apple.HIToolbox
0x00007fff8ab26aef RunCurrentEventLoopInMode + 235 16
com.apple.HIToolbox 0x00007fff8ab2686a
ReceiveNextEventCommon + 431 17 com.apple.HIToolbox
0x00007fff8ab266ab _BlockUntilNextEventMatchingListInModeWithFilter +
71 18 com.apple.AppKit 0x00007fff875eaf81
_DPSNextEvent + 964 19 com.apple.AppKit 0x00007fff875ea730 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 194 20
com.apple.AppKit 0x00007fff875de593 -[NSApplication
run] + 594 21 org.chromium.ContentShell.framework 0x000000010d1b7c81
0x10d080000 + 1277057 22 org.chromium.ContentShell.framework
0x000000010d1b72e4 0x10d080000 + 1274596 23
org.chromium.ContentShell.framework 0x000000010d1ef893 0x10d080000 +
1505427 24 org.chromium.ContentShell.framework 0x000000010d1dd80d
0x10d080000 + 1431565 25 com.genband.omni.mac
0x000000010ceb9d69 client::MainMessageLoopStd::Run() + 9
(main_message_loop_std.cc:15) 26 com.genband.omni.mac
0x000000010cee6c12 main + 2354 (cefclient_mac.mm:1747) 27
libdyld.dylib 0x00007fff8433d5c9 start + 1
Any suggestions are highly welcome
Changing the window_ delegate to nil, in dealloc method of root_window_mac.mm cleared the crash problem for me.
I have this code:
NSColor *color = [NSColor colorWithDeviceHue:hue
saturation:saturation
brightness:brightness
alpha:1.0];
NSString *scriptString = [NSString stringWithFormat:
#"try\n"
#"tell application \"Adobe Photoshop CS5\" \n"
#"set foreground color to {class:RGB color, red:%f, green:%f, blue:%f} \n"
#"end tell\n"
#"on error\n"
#"try\n"
#"tell application \"Adobe Photoshop CS4\" \n"
#"set foreground color to {class:RGB color, red:%f, green:%f, blue:%f} \n"
#"end tell\n"
#"end try\n"
#"end try",
[color redComponent] * 255,
[color greenComponent] * 255,
[color blueComponent] * 255];
NSLog(#"script string: %#", scriptString);
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:scriptString];
NSDictionary *error;
[script executeAndReturnError:&error];
NSLog(#"result: %#", error);
When I run it from xcode's run feature, it works just fine. When I build it as an application and run it standalone, it quite often crashes in this part.
Any idea why this might be?
EDIT: Most of the crash log (can't fit it all in here)
Process: The Color Picker Sync [1283]
Path: /Users/USER/*/The Color Picker Sync.app/Contents/MacOS/The Color Picker Sync
Identifier: com.Loupe.The-Color-Picker-Sync
Version: 1.1 (1.1)
Code Type: X86-64 (Native)
Parent Process: launchd [160]
Date/Time: 2012-01-21 14:04:54.025 +0000
OS Version: Mac OS X 10.7.2 (11C74)
Report Version: 9
Sleep/Wake UUID: 6BFBE167-51ED-433B-BB70-17D6C4054817
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 0000000101782000-000000010178c000 [ 40K] r-x/rwx SM=COW /Users/USER/*/The Color Picker Sync.app/Contents/MacOS/The Color Picker Sync
Application Specific Information:
objc_msgSend() selector name: respondsToSelector:
objc[1283]: garbage collection is OFF
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff90d8114d objc_msgSend_vtable5 + 13
1 com.apple.Foundation 0x00007fff8c239456 _NSDescriptionWithLocaleFunc + 50
2 com.apple.CoreFoundation 0x00007fff911284d5 __CFStringAppendFormatCore + 11365
3 com.apple.CoreFoundation 0x00007fff9117acdb _CFStringCreateWithFormatAndArgumentsAux + 107
4 com.apple.CoreFoundation 0x00007fff911f3182 _CFLogvEx + 114
5 com.apple.Foundation 0x00007fff8c2b3b53 NSLogv + 89
6 com.apple.Foundation 0x00007fff8c2b3af1 NSLog + 130
7 com.Loupe.The-Color-Picker-Sync 0x0000000101784103 -[StatusMenuItemSampleAppDelegate didReceiveMessage:] + 1023 (StatusMenuItemSampleAppDelegate.m:294)
8 com.Loupe.The-Color-Picker-Sync 0x00000001017848fb -[LocalRoom receivedNetworkPacket:viaConnection:] + 104 (LocalRoom.m:161)
9 com.Loupe.The-Color-Picker-Sync 0x0000000101785aa2 -[NetworkConnection readFromStreamIntoIncomingBuffer] + 416 (NetworkConnection.m:359)
10 com.apple.CoreFoundation 0x00007fff91183b7b _signalEventSync + 107
11 com.apple.CoreFoundation 0x00007fff91183b02 _cfstream_solo_signalEventSync + 98
12 com.apple.CoreFoundation 0x00007fff91183928 _CFStreamSignalEvent + 632
13 com.apple.CFNetwork 0x00007fff87459613 SocketStream::dispatchSignalFromSocketCallbackUnlocked(SocketStreamSignalHolder*) + 45
14 com.apple.CFNetwork 0x00007fff87458c72 SocketStream::socketCallback(__CFSocket*, unsigned long, __CFData const*, void const*) + 232
15 com.apple.CFNetwork 0x00007fff87458b72 SocketStream::_SocketCallBack_stream(__CFSocket*, unsigned long, __CFData const*, void const*, void*) + 100
16 com.apple.CoreFoundation 0x00007fff9117b714 __CFSocketPerformV0 + 980
17 com.apple.CoreFoundation 0x00007fff91133b51 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
18 com.apple.CoreFoundation 0x00007fff911333bd __CFRunLoopDoSources0 + 253
19 com.apple.CoreFoundation 0x00007fff9115a1a9 __CFRunLoopRun + 905
20 com.apple.CoreFoundation 0x00007fff91159ae6 CFRunLoopRunSpecific + 230
21 com.apple.HIToolbox 0x00007fff8e14d3d3 RunCurrentEventLoopInMode + 277
22 com.apple.HIToolbox 0x00007fff8e15463d ReceiveNextEventCommon + 355
23 com.apple.HIToolbox 0x00007fff8e1544ca BlockUntilNextEventMatchingListInMode + 62
24 com.apple.AppKit 0x00007fff8c5533f1 _DPSNextEvent + 659
25 com.apple.AppKit 0x00007fff8c552cf5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
26 com.apple.AppKit 0x00007fff8c54f62d -[NSApplication run] + 470
27 com.apple.AppKit 0x00007fff8c7ce80c NSApplicationMain + 867
28 com.Loupe.The-Color-Picker-Sync 0x000000010178302c 0x101782000 + 4140
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff8b3cc7e6 kevent + 10
1 libdispatch.dylib 0x00007fff8bf615be _dispatch_mgr_invoke + 923
2 libdispatch.dylib 0x00007fff8bf6014e _dispatch_mgr_thread + 54
Thread 2:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x00007fff8b3cbdf2 __select + 10
1 com.apple.CoreFoundation 0x00007fff911a2f9b __CFSocketManager + 1355
2 libsystem_c.dylib 0x00007fff90aad8bf _pthread_start + 335
3 libsystem_c.dylib 0x00007fff90ab0b75 thread_start + 13
Thread 3:
0 libsystem_kernel.dylib 0x00007fff8b3cc192 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff90aaf594 _pthread_wqthread + 758
2 libsystem_c.dylib 0x00007fff90ab0b85 start_wqthread + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff8b3cc192 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff90aaf594 _pthread_wqthread + 758
2 libsystem_c.dylib 0x00007fff90ab0b85 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000000 rcx: 0x00007fff6137ec80 rdx: 0x00007fff8c481ccc
rdi: 0x20200a3b31203d20 rsi: 0x00007fff76a0f730 rbp: 0x00007fff6137e970 rsp: 0x00007fff6137e958
r8: 0x000000000000000a r9: 0x000000000000057e r10: 0x0000000000000000 r11: 0x00007fca58557e21
r12: 0x00007fff91128644 r13: 0x000000000000000a r14: 0x20200a3b31203d20 r15: 0x0000000000000000
rip: 0x00007fff90d8114d rfl: 0x0000000000010246 cr2: 0x000000006a86fdc0
Logical CPU: 1
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 11
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 4860
thread_create: 1
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=211.3M resident=105.4M(50%) swapped_out_or_unallocated=105.9M(50%)
Writable regions: Total=48.2M written=3504K(7%) resident=19.3M(40%) swapped_out=1856K(4%) unallocated=29.0M(60%)
REGION TYPE VIRTUAL
=========== =======
CG backing stores 8K
CG raster data 64K
CG shared images 168K
CoreGraphics 16K
CoreServices 2004K
MALLOC 22.0M
MALLOC guard page 32K
Memory tag=240 4K
Memory tag=242 12K
Memory tag=243 16K
Memory tag=249 156K
STACK GUARD 56.0M
Stack 9820K
VM_ALLOCATE 16.1M
__CI_BITMAP 80K
__DATA 21.8M
__IMAGE 1256K
__LINKEDIT 47.6M
__RC_CAMERAS 236K
__TEXT 163.7M
__UNICODE 544K
mapped file 17.1M
shared memory 312K
=========== =======
TOTAL 358.7M
The most common mistake: NSAppleScript can only be used in the main app thread because it shares a AppleScript ComponentInstance. But if you show up crash log it helps.
You need to set error to nil initially:
NSDictionary *error = nil;
[script executeAndReturnError:&error] will change the value of error only if it fails. That's why you get a bad access if there's no error.