electron: Segmentation fault on color picker close

  • Electron Version: 1.8.7
  • Operating System (Platform and Version): macOS High Sierra (10.13.5)
  • Last known working Electron version: Unsure

Expected Behavior

Electron application should not crash when a user closes the color picker in macOS.

Actual behavior

Occasionally (not every time) when the end user closes a native color picker (from <input type="color" />), the browser process crashes.

Sometimes the termination signal is a Bus error: 10:

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

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x00007fff8b4060f0
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10
Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [0]

VM Regions Near 0x7fff8b4060f0:
    unused shlib __DATA    00007fff8b3d4000-00007fff8b404000 [  192K] rw-/rwx SM=COW  system shared lib __DATA not used by this process
--> __DATA                 00007fff8b404000-00007fff8b591000 [ 1588K] rw-/rwx SM=COW  /usr/lib/libobjc.A.dylib
    unused shlib __DATA    00007fff8b591000-00007fff8b59a000 [   36K] rw-/rwx SM=COW  system shared lib __DATA not used by this process

Application Specific Information:
Performing @selector(didChooseColor:) from sender NSColorPanel 0x7f90a462a5d0

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   ???                           	0x00007fff8b4060f0 OBJC_METACLASS_$_NSObject + 0
1   com.github.electron.framework 	0x0000000106c029f4 0x106ab3000 + 1374708
2   com.apple.AppKit              	0x00007fff28ab1a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
3   com.apple.AppKit              	0x00007fff287defab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
4   com.apple.AppKit              	0x00007fff287dee15 -[NSColorPanel _withColorSettingDisabled:] + 37
5   com.apple.AppKit              	0x00007fff287def41 -[NSColorPanel _forceSendAction:notification:firstResponder:] + 88
6   com.apple.AppKit              	0x00007fff287df136 -[NSColorPanel setColor:] + 182
...

Other times it’s a Segmentation fault: 11:

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 [0]

Application Specific Information:
Performing @selector(didChooseColor:) from sender NSColorPanel 0x7fd8d6f2ce60

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.github.electron.framework 	0x000000010d9cd760 ColorChooserMac::DidChooseColorInColorPanel(unsigned int) + 16
1   com.github.electron.framework 	0x000000010d9cd9f4 0x10d87e000 + 1374708
2   com.apple.AppKit              	0x00007fff28ab1a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
3   com.apple.AppKit              	0x00007fff287defab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
4   com.apple.AppKit              	0x00007fff287dee15 -[NSColorPanel _withColorSettingDisabled:] + 37
5   com.apple.AppKit              	0x00007fff287def41 -[NSColorPanel _forceSendAction:notification:firstResponder:] + 88
6   com.apple.AppKit              	0x00007fff287df136 -[NSColorPanel setColor:] + 182
...

To Reproduce

The easiest way to reproduce is with the packaged application, which can be downloaded from the GitHub releases page.

I have not been able to reproduce the problem in development mode, but here is the information if it’s helpful:

$ git clone git@github.com:mjswensen/themer-gui.git
$ npm install
$ npm start
  1. Hover over a label to reveal the droplet icon.
  • screen shot 2018-07-09 at 4 42 29 pm
  1. Click the droplet icon to open the color picker.
  2. Use the eyedropper tool to select a color from elsewhere on the screen.
  • image
  1. Click the red dot to close the color picker.
  • image

This is the point the application crashes. (Try a few times if it doesn’t happen the first time.)

Screenshots

crash report

Additional Information

The issue appears to only manifest when the eyedropper is used, specifically when selecting colors from a different application. (I haven’t seen a crash when the color picker sliders are used to select a color, for example.)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Sorry for the delay, it took a long time to figure out the upstream fixes needed - and to get them merged. A PR is up now to address this.

I investigated this today, and it looks like this is an upstream issue. I can crash electron and chrome with the following:

  • Open color chooser dialog
  • Adjust one of the RGB sliders to change the color
  • Close the dialog, then open it again
  • Adjust the color again
  • Close the dialog

At this point the app should crash. I managed to cook up a fix for this, going to post a PR with a patch and a PR to chromium to fix this tomorrow.

I am still experiencing this segmentation fault on Mojave version 10.14.2 using electron v4.0.2. Did anyone find a workaround ?

@groundwater Can we reopen this issue? It’s still a persistent bug.

@groundwater, I hate to be the bearer of bad news but I just repro’ed the issue again, this time on electron@2.0.8 (still macOS 10.13.6), which I released as part of themer-gui v0.18.2.

Here is a snippet of the stack from the crash report window. Happy to send along more if it’s helpful.

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   ???                           	0x0000000200000003 0 + 8589934595
1   com.github.electron.framework 	0x0000000103344096 ColorChooserMac::DidChooseColorInColorPanel(unsigned int) + 22
2   com.github.electron.framework 	0x0000000103344324 0x1031cf000 + 1528612
3   com.apple.AppKit              	0x00007fff48ab5a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
4   com.apple.AppKit              	0x00007fff487e2fab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
5   com.apple.AppKit              	0x00007fff487e2e15 -[NSColorPanel _withColorSettingDisabled:] + 37