Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing window with -webkit-app-region:drag regions crashes on Mac OS X #3669

Closed
bengotow opened this issue Dec 2, 2015 · 8 comments
Closed

Comments

@bengotow
Copy link
Contributor

bengotow commented Dec 2, 2015

Since moving to Electron 0.35+, we've had intermittent reports of the app crashing when the user goes to close a window that has draggable regions on Mac OS X (nylas/nylas-mail#519). Here's the crash log:

    __TEXT                 0000000104907000-0000000104908000 [    4K] r-x/rwx SM=COW  /Applications/Nylas N1.app/Contents/MacOS/Nylas

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.github.electron.framework   0x000000010499650a atom::NativeWindowMac::UpdateDraggableRegionViews(std::__1::vector<atom::DraggableRegion, std::__1::allocator<atom::DraggableRegion> > const&) + 74
1   com.github.electron.framework   0x0000000104996ac0 atom::NativeWindowMac::UpdateDraggableRegionViews() + 16
2   com.github.electron.framework   0x00000001049938da base::internal::RunnableAdapter<void (atom::NativeWindow::*)()>::Run(atom::NativeWindow*) + 1098
3   com.apple.CoreFoundation        0x00007fff895ac45c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
4   com.apple.CoreFoundation        0x00007fff8949c634 _CFXNotificationPost + 3140
5   com.apple.Foundation            0x00007fff8c06daa1 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
6   com.apple.AppKit                0x00007fff85544660 -[NSWindow _setFrameCommon:display:stashSize:] + 2885
7   com.apple.AppKit                0x00007fff8563f70e __25-[NSWindow setStyleMask:]_block_invoke + 2142
8   com.apple.AppKit                0x00007fff8555ebdb NSPerformWithScreenUpdatesDisabled + 65
9   com.apple.AppKit                0x00007fff8563ee22 -[NSWindow setStyleMask:] + 222
10  com.apple.AppKit                0x00007fff85723d95 __18-[NSWindow _close]_block_invoke + 695
11  com.apple.AppKit                0x00007fff85723a96 -[NSWindow _close] + 376
12  com.github.electron.framework   0x0000000104994fd0 atom::NativeWindowMac::CloseImmediately() + 32
13  com.github.electron.framework   0x0000000104990fb4 atom::NativeWindow::CloseContents(content::WebContents*) + 68
14  com.github.electron.framework   0x000000010495d7e5 atom::api::WebContents::CloseContents(content::WebContents*) + 85
15  com.github.electron.framework   0x000000010495d7fd non-virtual thunk to atom::api::WebContents::CloseContents(content::WebContents*) + 13
16  com.github.electron.framework   0x00000001051580f3 base::internal::DstRangeRelationToSrcRangeImpl<int, long, (base::internal::IntegerRepresentation)1, (base::internal::IntegerRepresentation)1, (base::internal::NumericRangeRepresentation)0>::Check(long) + 7419603
17  com.github.electron.framework   0x000000010514d7a9 base::internal::DstRangeRelationToSrcRangeImpl<int, long, (base::internal::IntegerRepresentation)1, (base::internal::IntegerRepresentation)1, (base::internal::NumericRangeRepresentation)0>::Check(long) + 7376265
18  com.github.electron.framework   0x0000000105835588 _CTFontManagerUnregisterFontForData + 4751256

I think this is related to #3163—it looks like the app is trying to re-compute draggable regions, but /after/ the window has been closed? Will try to create a failure case.

@zcbenz
Copy link
Contributor

zcbenz commented Dec 4, 2015

Electron recomputes the draggable regions when window is resized, it seems that OS X is resizing the window when it is closed.

@jstejada
Copy link

I'm able to consistently replicate this when I have chrome dev tools open on a separate window and I quit electron directly with Cmd + Q.

@zcbenz
Copy link
Contributor

zcbenz commented Apr 13, 2016

Never saw similar reports recently, I believe it was a bug of OS X and got fixed then.

@zcbenz zcbenz closed this as completed Apr 13, 2016
@bengotow
Copy link
Contributor Author

Hey folks—we've seen a handful of reports of this happening with Electron 1.4.1 again. Same stack trace. I'm trying to narrow it down and will post again if there's any more info.

@bpasero
Copy link
Contributor

bpasero commented Nov 8, 2016

@zcbenz we are also seeing this issue. here are the steps that lead to the crash in our case:

  • electron 1.3.8
  • Mac OS X 10.12.1
  • title style hidden
  • a title region to the top is using the -webkit-app-region: drag;
  • open 2 windows in fullscreen using the tabs feature of Sierra (you end up with 2 tabs)
  • close the second fullscreen window

Dump:

Process: Electron [18535]
Path: /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
Identifier: com.microsoft.VSCodeInsiders
Version: 1.8.0-insider (1.8.0-insider)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Electron [18535]
User ID: 501

Date/Time: 2016-11-08 14:36:42.297 +0100
OS Version: Mac OS X 10.12.1 (16B2555)
Report Version: 12
Anonymous UUID: DD1CF50F-92CE-D9B6-13AA-62FE91EAD250

Sleep/Wake UUID: DA10F2B7-89C9-4741-9156-B5579A0046DD

Time Awake Since Boot: 36000 seconds
Time Since Wake: 17000 seconds

System Integrity Protection: enabled

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

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

VM Regions Near 0:
--> 
__TEXT 0000000100b4b000-0000000100b4c000 [ 4K] r-x/rwx SM=COW /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 com.github.electron.framework 0x0000000101326e0e atom::NativeWindowMac::UpdateDraggableRegionViews(std::1::vector > const&) + 62
1 com.github.electron.framework 0x0000000101322460 atom::NativeWindowMac::UpdateDraggableRegionViews() + 16
2 com.github.electron.framework 0x000000010132243a 0x10127b000 + 685114
3 com.apple.CoreFoundation 0x00007fffb4aed59c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12
4 com.apple.CoreFoundation 0x00007fffb4aed49b CFXRegistrationPost + 427
5 com.apple.CoreFoundation 0x00007fffb4aed202 ___CFXNotificationPost_block_invoke + 50
6 com.apple.CoreFoundation 0x00007fffb4aaa903 -[CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
7 com.apple.CoreFoundation 0x00007fffb4aa993c _CFXNotificationPost + 604
8 com.apple.Foundation 0x00007fffb64b90e3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
9 com.apple.AppKit 0x00007fffb282b177 -[NSWindow _setFrameCommon:display:stashSize:] + 3326
10 com.apple.AppKit 0x00007fffb282a46b -[NSWindow _setFrame:display:allowImplicitAnimation:stashSize:] + 222
11 com.apple.AppKit 0x00007fffb282a386 -[NSWindow setFrame:display:] + 67
12 com.github.electron.framework 0x0000000101322de3 0x10127b000 + 687587
13 com.apple.AppKit 0x00007fffb2a6758c -[NSToolbarFullScreenWindowManager resizeContentWindow] + 233
14 com.apple.AppKit 0x00007fffb28914c0 NSPerformVisuallyAtomicChange + 147
15 com.apple.AppKit 0x00007fffb30ec6d5 -[NSToolbarFullScreenWindowManager layout] + 107
16 com.apple.AppKit 0x00007fffb2787782 -[NSThemeFrame _updateTitlebarContainerViewFrameIfNecessary] + 573
17 com.apple.AppKit 0x00007fffb27a6404 -[NSThemeFrame _relayoutAuxiliaryViewsOfType:] + 175
18 com.apple.AppKit 0x00007fffb27a6341 -[NSThemeFrame relayoutAuxiliaryViewsOfType:] + 27
19 com.apple.AppKit 0x00007fffb2b01780 -[NSTitlebarViewController removeChildViewControllerAtIndex:] + 433
20 com.apple.AppKit 0x00007fffb2f2839b -[NSWindowStackController _removeTabBarAccessoryViewControllerForWindow:] + 220
21 com.apple.AppKit 0x00007fffb2f2938c -[NSWindowStackController removeWindow:] + 774
22 com.apple.AppKit 0x00007fffb2b6a39c -[NSWindow(NSWindowTabbing) _doTabbedWindowCleanupForOrderOut] + 85
23 com.apple.AppKit 0x00007fffb29f5569 __18-[NSWindow _close]_block_invoke + 82
24 com.apple.AppKit 0x00007fffb29f54c8 -[NSWindow _close] + 365
25 com.github.electron.framework 0x0000000101324fd0 atom::NativeWindowMac::CloseImmediately() + 32
26 com.github.electron.framework 0x000000010131fda8 atom::NativeWindow::CloseContents(content::WebContents) + 168
27 com.github.electron.framework 0x00000001012dbcaf atom::api::WebContents::CloseContents(content::WebContents) + 111
28 com.github.electron.framework 0x00000001012dbced non-virtual thunk to atom::api::WebContents::CloseContents(content::WebContents*) + 13
29 com.github.electron.framework 0x0000000101df7bd2 0x10127b000 + 12045266
30 com.github.electron.framework 0x0000000101df5903 0x10127b000 + 12036355
31 com.github.electron.framework 0x0000000101dfc4a1 0x10127b000 + 12063905
32 com.github.electron.framework 0x0000000101dea2a9 0x10127b000 + 11989673
33 com.github.electron.framework 0x00000001023ae7d8 0x10127b000 + 18036696
34 com.github.electron.framework 0x000000010146823b 0x10127b000 + 2019899
35 com.github.electron.framework 0x0000000101489053 0x10127b000 + 2154579
36 com.github.electron.framework 0x000000010148934c 0x10127b000 + 2155340
37 com.github.electron.framework 0x00000001014896ab 0x10127b000 + 2156203
38 com.github.electron.framework 0x000000010145cddd 0x10127b000 + 1973725
39 com.github.electron.framework 0x00000001014801ca 0x10127b000 + 2118090
40 com.github.electron.framework 0x000000010145c7e4 0x10127b000 + 1972196
41 com.apple.CoreFoundation 0x00007fffb4af74b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
42 com.apple.CoreFoundation 0x00007fffb4ad861d __CFRunLoopDoSources0 + 557
43 com.apple.CoreFoundation 0x00007fffb4ad7b16 __CFRunLoopRun + 934
44 com.apple.CoreFoundation 0x00007fffb4ad7514 CFRunLoopRunSpecific + 420
45 com.apple.HIToolbox 0x00007fffb4074fbc RunCurrentEventLoopInMode + 240
46 com.apple.HIToolbox 0x00007fffb4074df1 ReceiveNextEventCommon + 432
47 com.apple.HIToolbox 0x00007fffb4074c26 _BlockUntilNextEventMatchingListInModeWithFilter + 71
48 com.apple.AppKit 0x00007fffb275eb79 _DPSNextEvent + 1093
49 com.apple.AppKit 0x00007fffb2e741c3 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1637
50 com.apple.AppKit 0x00007fffb275353d -[NSApplication run] + 926
51 com.github.electron.framework 0x000000010145d636 0x10127b000 + 1975862
52 com.github.electron.framework 0x000000010145cc34 0x10127b000 + 1973300
53 com.github.electron.framework 0x000000010149f571 0x10127b000 + 2246001
54 com.github.electron.framework 0x0000000101bc781b 0x10127b000 + 9750555
55 com.github.electron.framework 0x0000000101bc7670 0x10127b000 + 9750128
56 com.github.electron.framework 0x0000000101bc9bc2 0x10127b000 + 9759682
57 com.github.electron.framework 0x0000000101bc398d 0x10127b000 + 9734541
58 com.github.electron.framework 0x0000000101b2f880 0x10127b000 + 9128064
59 com.github.electron.framework 0x0000000101b2ea66 0x10127b000 + 9124454
60 com.github.electron.framework 0x000000010127cf87 AtomMain + 71
61 com.microsoft.VSCodeInsiders 0x0000000100b4bf26 main + 38
62 libdyld.dylib 0x00007fffc9ba2255 start + 1

@bpasero
Copy link
Contributor

bpasero commented Nov 10, 2016

@zcbenz @kevinsawicki this should probably be reopened, we have a repro:

@bpasero bpasero reopened this Nov 10, 2016
@bpasero
Copy link
Contributor

bpasero commented Nov 10, 2016

Hm, does not repro with latest. I suspect that this was fixed as part of the change to disable tabs for Electron apps. So this bug seems only to happen when you are using the native tabs feature of Sierra. I am closing this again, but it might come back once Electron officially supports Sierra tabs.

@bpasero bpasero closed this as completed Nov 10, 2016
@bpasero
Copy link
Contributor

bpasero commented Nov 10, 2016

This is the change I was referring to: #7415

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants