Demo App crashes when dock icon is clicked when there are no open windows

I have handled activate event to reopen window when user click on dock icon when there are no opened windows but the app crashes with error:

Electron[16724:13128485] -[_CFPasteboardCache removeAllObjects]: unrecognized selector sent to instance 0x7f9b674b6f70

app.on('activate', () => {
      if (BrowserWindow.getAllWindows().length == 0) {
        createWindow();
      }
    });

Hi zishanj,

Thanks for the post. What is the SDK version you are using and is this happening on Windows or Mac(Or both?)

SDK Ver: 4.6.15088.0210
Mac: Catalina 10.15.3
Electron: 8.2
Node: 13.2

Hi zishanj,
Thanks for the reply. We tried to reproduce this issue with the same versions that you are having but no luck. The interface createWindow is not an SDK interface, and it is hard to tell whether this issue is related to our SDK based on the provided info. If you could let us know the steps to reproduce this with our demo app or provide the SDK log for further investigation, it would be helpful.

Thanks!

Actually I have modified the code a bit to automate the 3 startup screens; domain screen, sdk screen, login screen. Instead of showing their windows I have used this directly:

functionObj['setDomain']('https://www.zoom.us', false);
functionObj['sdkauth']('my_key', 'my_secret');
functionObj['login']('my_username', 'my_password');

Here is the partial crash report:

Process: Electron [23240]
Path: /Users/USER/*/Electron.app/Contents/MacOS/Electron
Identifier: com.github.Electron
Version: 8.2.0 (8.2.0)
Code Type: X86-64 (Native)
Parent Process: ??? [23239]
Responsible: iTerm2 [33529]
User ID: 501

Date/Time: 2020-04-03 02:58:18.027 +0500
OS Version: Mac OS X 10.15.3 (19D76)
Report Version: 12
Anonymous UUID: D89DE715-7ABF-2C0B-039F-D800D1A0FEE7

Sleep/Wake UUID: 44ED0987-EF9F-4C1C-81B5-99FFDE037068

Time Awake Since Boot: 3800000 seconds
Time Since Wake: 2000000 seconds

System Integrity Protection: enabled

Crashed Thread: 0 CrBrowserMain Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [23240]

Application Specific Information:
objc_msgSend() selector name: removeAllObjects

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff68e83029 objc_msgSend + 41
1 zoom.us.ZoomSDK 0x0000000117997bc2 0x1178b3000 + 936898
2 zoomsdk.node 0x00000001177ebb22 ZNativeSDKWrap::InitSDK(_ZNInitParam&) + 86 (zoom_native_sdk_wrap_core.mm:12)
3 zoomsdk.node 0x00000001177f0837 ZoomNodeWrap::InitSDK(v8::FunctionCallbackInfov8::Value const&) + 763 (zoom_node_addon.cpp:143)
4 com.github.Electron.framework 0x000000010f9598fc 0x10ec64000 + 13588732
5 com.github.Electron.framework 0x000000010f958dfa 0x10ec64000 + 13585914
6 com.github.Electron.framework 0x000000010f9583d2 0x10ec64000 + 13583314
7 com.github.Electron.framework 0x000000011035b7d9 0x10ec64000 + 24082393
8 com.github.Electron.framework 0x00000001102eb278 0x10ec64000 + 23622264
9 com.github.Electron.framework 0x00000001102eb278 0x10ec64000 + 23622264
10 com.github.Electron.framework 0x00000001102eb278 0x10ec64000 + 23622264
11 com.github.Electron.framework 0x00000001102eb278 0x10ec64000 + 23622264
12 com.github.Electron.framework 0x00000001102e4c79 0x10ec64000 + 23596153
13 com.github.Electron.framework 0x00000001102e8b7a 0x10ec64000 + 23612282
14 com.github.Electron.framework 0x00000001102e8958 0x10ec64000 + 23611736
15 com.github.Electron.framework 0x000000010fa12708 0x10ec64000 + 14345992
16 com.github.Electron.framework 0x000000010fa122fe v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, int, v8::internal::Handlev8::internal::Object) + 206
17 com.github.Electron.framework 0x000000010f906bac v8::Function::Call(v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value
) + 444
18 com.github.Electron.framework 0x0000000114464381 0x10ec64000 + 92275585
19 com.github.Electron.framework 0x00000001144645d1 node::MakeCallback(v8::Isolate*, v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value, node::async_context) + 161
20 com.github.Electron.framework 0x000000010edb86ff 0x10ec64000 + 1394431
21 com.github.Electron.framework 0x000000010ec8adc6 0x10ec64000 + 159174
22 com.github.Electron.framework 0x000000010ec890f3 0x10ec64000 + 151795
23 com.github.Electron.framework 0x000000010ed44038 0x10ec64000 + 917560
24 com.apple.CoreFoundation 0x00007fff32b4f35f CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12
25 com.apple.CoreFoundation 0x00007fff32b4f2f3 ___CFXRegistrationPost1_block_invoke + 63
26 com.apple.CoreFoundation 0x00007fff32b4f268 _CFXRegistrationPost1 + 372
27 com.apple.CoreFoundation 0x00007fff32b4eebe ___CFXNotificationPost_block_invoke + 97
28 com.apple.CoreFoundation 0x00007fff32b1e7e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1575
29 com.apple.CoreFoundation 0x00007fff32b1dc82 _CFXNotificationPost + 1351
30 com.apple.Foundation 0x00007fff351a3a22 -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
31 com.apple.SkyLight 0x00007fff60e7f08d (anonymous namespace)::notify_datagram_handler(unsigned int, CGSDatagramType, void
, unsigned long, void*) + 634
32 com.apple.SkyLight 0x00007fff60e82fac CGSDatagramReadStream::dispatch_next_main_queue_datagram() + 242
33 com.apple.SkyLight 0x00007fff610b5985 invocation function for block in CGSDatagramReadStream::dispatch_main_queue_datagrams_async(dispatch_queue_s*, CGSDatagramReadStream*) + 54
34 libdispatch.dylib 0x00007fff6a1a3583 _dispatch_call_block_and_release + 12
35 libdispatch.dylib 0x00007fff6a1a450e _dispatch_client_callout + 8
36 libdispatch.dylib 0x00007fff6a1afbc4 _dispatch_main_queue_callback_4CF + 1105
37 com.apple.CoreFoundation 0x00007fff32b98e00 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
38 com.apple.CoreFoundation 0x00007fff32b58b8a __CFRunLoopRun + 2370
39 com.apple.CoreFoundation 0x00007fff32b57bd3 CFRunLoopRunSpecific + 499
40 com.apple.HIToolbox 0x00007fff316ad65d RunCurrentEventLoopInMode + 292
41 com.apple.HIToolbox 0x00007fff316ad39d ReceiveNextEventCommon + 600
42 com.apple.HIToolbox 0x00007fff316ad127 _BlockUntilNextEventMatchingListInModeWithFilter + 64
43 com.apple.AppKit 0x00007fff2fd1dba4 _DPSNextEvent + 990
44 com.apple.AppKit 0x00007fff2fd1c380 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
45 com.apple.AppKit 0x00007fff2fd0e09e -[NSApplication run] + 658
46 com.github.Electron.framework 0x0000000110f0b5ac 0x10ec64000 + 36337068
47 com.github.Electron.framework 0x0000000110f0a012 0x10ec64000 + 36331538
48 com.github.Electron.framework 0x0000000110ebca77 0x10ec64000 + 36014711
49 com.github.Electron.framework 0x0000000110e94d67 0x10ec64000 + 35851623
50 com.github.Electron.framework 0x00000001106d74b3 0x10ec64000 + 27735219
51 com.github.Electron.framework 0x00000001106d8f42 0x10ec64000 + 27742018
52 com.github.Electron.framework 0x00000001106d499a 0x10ec64000 + 27724186
53 com.github.Electron.framework 0x000000011056fd24 0x10ec64000 + 26262820
54 com.github.Electron.framework 0x000000011056fa2e 0x10ec64000 + 26262062
55 com.github.Electron.framework 0x00000001127b5904 0x10ec64000 + 62200068
56 com.github.Electron.framework 0x000000010f82d6f4 0x10ec64000 + 12359412
57 com.github.Electron.framework 0x000000010ec66b94 ElectronMain + 84
58 com.github.Electron 0x000000010b91d9b0 0x10b91d000 + 2480
59 libdyld.dylib 0x00007fff6a1fd7fd start + 1

Thread 1:
0 libsystem_pthread.dylib 0x00007fff6a3fd818 start_wqthread + 0

Thread 2:: Dispatch queue: NSCGSDisableUpdates
0 libsystem_kernel.dylib 0x00007fff6a33e2ae semaphore_timedwait_trap + 10
1 com.apple.SkyLight 0x00007fff60eb76b0 CGSUpdateManager::enable_updates_common() + 302
2 com.apple.SkyLight 0x00007fff60eb7de7 SLSReenableUpdateTokenWithSeed + 121
3 libdispatch.dylib 0x00007fff6a1a3583 _dispatch_call_block_and_release + 12
4 libdispatch.dylib 0x00007fff6a1a450e _dispatch_client_callout + 8
5 libdispatch.dylib 0x00007fff6a1a9ace _dispatch_lane_serial_drain + 597
6 libdispatch.dylib 0x00007fff6a1aa452 _dispatch_lane_invoke + 363
7 libdispatch.dylib 0x00007fff6a1b3a9e _dispatch_workloop_worker_thread + 598
8 libsystem_pthread.dylib 0x00007fff6a3fe6fc _pthread_wqthread + 290
9 libsystem_pthread.dylib 0x00007fff6a3fd827 start_wqthread + 15

Hi zishanj,

Thanks for the reply and thanks for the information. Based on the info:

functionObj['setDomain']('https://www.zoom.us', false);
functionObj['sdkauth']('my_key', 'my_secret');
functionObj['login']('my_username', 'my_password');

These 3 steps need to be running in order, they cannot run simultaneously. Please have a try with the following:

  1. setDomain -> if the setDomain success, proceed to SDKAuth
  2. Perform SDKAUth -> if the SDKAuth success, proceed to login; Please note that the SDKAuth is an async behavior, you should only go to login page if the SDK auth is success

Please have a try and hope this helps. Thanks!