czarny/brisync

Crashes when Screens Disconnected

Closed this issue · 3 comments

Whenever I unplug my screens, Brisync crashes. I ran it in debug mode and got it to produce the following stack trace:

2017-10-14 17:36:55.744715-0700 Brisync[21498:1406111] *** Assertion failure in -[NSTextFieldCell _objectValue:forString:errorDescription:], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1504.83.101/AppKit.subproj/NSCell.m:1674
2017-10-14 17:36:55.885115-0700 Brisync[21498:1406111] [General] An uncaught exception was raised
2017-10-14 17:36:55.890369-0700 Brisync[21498:1406111] [General] Invalid parameter not satisfying: aString != nil
2017-10-14 17:36:55.890569-0700 Brisync[21498:1406111] [General] (
	0   CoreFoundation                      0x00007fffd46c72cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffe94df48d objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffd46cc042 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x00007fffd6114be0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
	4   AppKit                              0x00007fffd2163dcd -[NSCell _objectValue:forString:errorDescription:] + 177
	5   AppKit                              0x00007fffd2163c72 -[NSCell setStringValue:] + 41
	6   AppKit                              0x00007fffd221291e -[NSControl setStringValue:] + 135
	7   Brisync                             0x0000000100003108 -[MainController loadDisplays] + 1096
	8   Brisync                             0x0000000100003cc5 displayConfigurationChanged + 53
	9   SkyLight                            0x00007fffe6113449 displayWillConfigNotifyProc + 440
	10  SkyLight                            0x00007fffe6205221 CGSPostLocalNotification + 612
	11  SkyLight                            0x00007fffe6204c78 _ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ + 82
	12  SkyLight                            0x00007fffe60eecb9 _ZN21CGSDatagramReadStream33dispatch_next_main_queue_datagramEv + 283
	13  SkyLight                            0x00007fffe60eeb89 ___ZN21CGSDatagramReadStream35dispatch_main_queue_datagrams_asyncEP16dispatch_queue_sPS__block_invoke + 55
	14  libdispatch.dylib                   0x00000001000c0cfe _dispatch_call_block_and_release + 12
	15  libdispatch.dylib                   0x00000001000b778c _dispatch_client_callout + 8
	16  libdispatch.dylib                   0x00000001000c5ac4 _dispatch_main_queue_callback_4CF + 362
	17  CoreFoundation                      0x00007fffd467cbc9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	18  CoreFoundation                      0x00007fffd463dc0d __CFRunLoopRun + 2205
	19  CoreFoundation                      0x00007fffd463d114 CFRunLoopRunSpecific + 420
	20  HIToolbox                           0x00007fffd3b9debc RunCurrentEventLoopInMode + 240
	21  HIToolbox                           0x00007fffd3b9dcf1 ReceiveNextEventCommon + 432
	22  HIToolbox                           0x00007fffd3b9db26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
	23  AppKit                              0x00007fffd2136a54 _DPSNextEvent + 1120
	24  AppKit                              0x00007fffd28b27ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
	25  AppKit                              0x00007fffd212b3db -[NSApplication run] + 926
	26  AppKit                              0x00007fffd20f5e0e NSApplicationMain + 1237
	27  Brisync                             0x00000001000011f2 main + 34
	28  libdyld.dylib                       0x00007fffe9dc5235 start + 1
	29  ???                                 0x0000000000000003 0x0 + 3
)
2017-10-14 17:36:55.924088-0700 Brisync[21498:1406111] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: aString != nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fffd46c72cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffe94df48d objc_exception_throw + 48
	2   CoreFoundation                      0x00007fffd46cc042 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x00007fffd6114be0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
	4   AppKit                              0x00007fffd2163dcd -[NSCell _objectValue:forString:errorDescription:] + 177
	5   AppKit                              0x00007fffd2163c72 -[NSCell setStringValue:] + 41
	6   AppKit                              0x00007fffd221291e -[NSControl setStringValue:] + 135
	7   Brisync                             0x0000000100003108 -[MainController loadDisplays] + 1096
	8   Brisync                             0x0000000100003cc5 displayConfigurationChanged + 53
	9   SkyLight                            0x00007fffe6113449 displayWillConfigNotifyProc + 440
	10  SkyLight                            0x00007fffe6205221 CGSPostLocalNotification + 612
	11  SkyLight                            0x00007fffe6204c78 _ZN12_GLOBAL__N_123notify_datagram_handlerEj15CGSDatagramTypePvmS1_ + 82
	12  SkyLight                            0x00007fffe60eecb9 _ZN21CGSDatagramReadStream33dispatch_next_main_queue_datagramEv + 283
	13  SkyLight                            0x00007fffe60eeb89 ___ZN21CGSDatagramReadStream35dispatch_main_queue_datagrams_asyncEP16dispatch_queue_sPS__block_invoke + 55
	14  libdispatch.dylib                   0x00000001000c0cfe _dispatch_call_block_and_release + 12
	15  libdispatch.dylib                   0x00000001000b778c _dispatch_client_callout + 8
	16  libdispatch.dylib                   0x00000001000c5ac4 _dispatch_main_queue_callback_4CF + 362
	17  CoreFoundation                      0x00007fffd467cbc9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	18  CoreFoundation                      0x00007fffd463dc0d __CFRunLoopRun + 2205
	19  CoreFoundation                      0x00007fffd463d114 CFRunLoopRunSpecific + 420
	20  HIToolbox                           0x00007fffd3b9debc RunCurrentEventLoopInMode + 240
	21  HIToolbox                           0x00007fffd3b9dcf1 ReceiveNextEventCommon + 432
	22  HIToolbox                           0x00007fffd3b9db26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
	23  AppKit                              0x00007fffd2136a54 _DPSNextEvent + 1120
	24  AppKit                              0x00007fffd28b27ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
	25  AppKit                              0x00007fffd212b3db -[NSApplication run] + 926
	26  AppKit                              0x00007fffd20f5e0e NSApplicationMain + 1237
	27  Brisync                             0x00000001000011f2 main + 34
	28  libdyld.dylib                       0x00007fffe9dc5235 start + 1
	29  ???                                 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

It looks like system still detects an external display after disconnection but cannot read its name.
I wonder how can I fix it since I cannot reproduce in on my setup. What exactly is your setup?

Hi, I made a small fix which could resolve the problem. Can you please pull changes and try debug it now?

Incidentally, I can hot swap my monitors, and have no errors. Brisync keeps running.