Skip to content

0.32.3: Opening a window from the activate event crashes on OS X #2791

Closed

Description

@bpasero

I am adopting the new activate event in 0.32.3 and get a native crash on OS X when trying to open a window in case hasVisibleWindows is false. This used to work previously with activated-with-open-windows.

./code.sh: line 21: 1800 Segmentation fault: 11 ../Electron-Build/Electron.app/Contents/MacOS/Electron . $*

I dont really want to attach the full dump to this report, maybe @zcbenz you can let me know how I can share the dump best or what info you need.

Activity

  1. hokein commented on Sep 16, 2015

    @hokein
    Contributor

    I can reproduce it with the following code:

    var app = require('app');
    var BrowserWindow = require('browser-window');
    var dialog = require('dialog');
    var mainWindow = null;
    var win = null;
    
    // Quit when all windows are closed.
    app.on('window-all-closed', function() {
    });
    
    app.on('ready', function() {
      mainWindow = new BrowserWindow({
        width: 800,
        height: 600,
        'auto-hide-menu-bar': true,
        'use-content-size': true,
      });
      mainWindow.loadUrl('file://' + __dirname + '/index.html');
      mainWindow.focus();
      app.on('activate', function(event, hasVisibleWindows) {
        if (!hasVisibleWindows) {
          win = new BrowserWindow({
            width: 800,
            height: 600,
          });
          win.loadUrl('file://' + __dirname + '/index.html');
        }
      });
    });
    

    The crash stack trace:

    Time Awake Since Boot: 400000 seconds
    Time Since Wake:       2100 seconds
    
    Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread
    
    Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes:       EXC_I386_GPFLT
    
    Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
    0   Electron Framework              0x000000010ef3b2b0 -[BRYInspectableWebContentsView viewDidBecomeFirstResponder:] + 64
    1   com.apple.CoreFoundation        0x00007fff94f2b45c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    2   com.apple.CoreFoundation        0x00007fff94e1b634 _CFXNotificationPost + 3140
    3   com.apple.Foundation            0x00007fff953739d1 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
    4   libcontent.dylib                0x00000001121a7bcc 0x111f07000 + 2755532
    5   com.apple.AppKit                0x00007fff906276f5 -[NSWindow makeFirstResponder:] + 727
    6   libcontent.dylib                0x0000000112271747 0x111f07000 + 3581767
    7   Electron Framework              0x000000010ed692f0 atom::api::WebContents::Focus() + 48
    8   Electron Framework              0x000000010ed76719 base::internal::RunnableAdapter<void (atom::api::WebContents::*)()>::Run(atom::api::WebContents*) + 105
    9   Electron Framework              0x000000010ed766a9 base::internal::InvokeHelper<false, void, base::internal::RunnableAdapter<void (atom::api::WebContents::*)()>, base::internal::TypeList<atom::api::WebContents* const&> >::MakeItSo(base::internal::RunnableAdapter<void (atom::api::WebContents::*)()>, atom::api::WebContents* const&) + 41
    10  Electron Framework              0x000000010ed76675 base::internal::Invoker<base::IndexSequence<>, base::internal::BindState<base::internal::RunnableAdapter<void (atom::api::WebContents::*)()>, void (atom::api::WebContents*), base::internal::TypeList<> >, base::internal::TypeList<>, base::internal::InvokeHelper<false, void, base::internal::RunnableAdapter<void (atom::api::WebContents::*)()>, base::internal::TypeList<atom::api::WebContents* const&> >, void (atom::api::WebContents* const&)>::Run(base::internal::BindStateBase*, atom::api::WebContents* const&) + 69
    11  Electron Framework              0x000000010ed763d6 base::Callback<void (atom::api::WebContents*)>::Run(atom::api::WebContents* const&) const + 70
    12  Electron Framework              0x000000010ed75fc0 mate::internal::Invoker<mate::internal::IndicesHolder<0ul>, atom::api::WebContents*>::DispatchToCallback(base::Callback<void (atom::api::WebContents*)>) + 32
    13  Electron Framework              0x000000010ed75da6 mate::internal::Dispatcher<void (atom::api::WebContents*)>::DispatchToCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 326
    14  libv8.dylib                     0x000000011022324f v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) + 159
    15  libv8.dylib                     0x000000011024c2a9 0x1101eb000 + 397993
    16  libv8.dylib                     0x000000011024ef8d 0x1101eb000 + 409485
    17  ???                             0x0000350ee5409b7b 0 + 58338092030843
    18  ???                             0x0000350ee5597b08 0 + 58338093660936
    19  ???                             0x0000350ee540a537 0 + 58338092033335
    20  ???                             0x0000350ee54345e3 0 + 58338092205539
    21  ???                             0x0000350ee55834b6 0 + 58338093577398
    22  ???                             0x0000350ee540a537 0 + 58338092033335
    23  ???                             0x0000350ee5535e72 0 + 58338093260402
    24  ???                             0x0000350ee55359e5 0 + 58338093259237
    25  ???                             0x0000350ee540a537 0 + 58338092033335
    26  ???                             0x0000350ee5597239 0 + 58338093658681
    27  ???                             0x0000350ee540a537 0 + 58338092033335
    28  ???                             0x0000350ee54345e3 0 + 58338092205539
    29  ???                             0x0000350ee5596ff2 0 + 58338093658098
    30  ???                             0x0000350ee540a537 0 + 58338092033335
    31  ???                             0x0000350ee54345e3 0 + 58338092205539
    32  ???                             0x0000350ee5596ebb 0 + 58338093657787
    33  ???                             0x0000350ee540a537 0 + 58338092033335
    34  ???                             0x0000350ee55b28b8 0 + 58338093770936
    35  ???                             0x0000350ee540a537 0 + 58338092033335
    36  ???                             0x0000350ee55b256c 0 + 58338093770092
    37  ???                             0x0000350ee5535916 0 + 58338093259030
    38  ???                             0x0000350ee55b2446 0 + 58338093769798
    39  ???                             0x0000350ee5535e72 0 + 58338093260402
    40  ???                             0x0000350ee55359e5 0 + 58338093259237
    41  ???                             0x0000350ee540a537 0 + 58338092033335
    42  ???                             0x0000350ee54318f9 0 + 58338092194041
    43  ???                             0x0000350ee54160a2 0 + 58338092081314
    44  libv8.dylib                     0x0000000110386ff5 0x1101eb000 + 1687541
    45  libv8.dylib                     0x000000011020a504 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 276
    46  libnode.dylib                   0x000000010f8918e0 node::MakeCallback(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) + 1200 (node.cc:1080)
    47  libnode.dylib                   0x000000010f891d3e node::MakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*) + 174 (node.cc:1130)
    48  libnode.dylib                   0x000000010f891db1 node::MakeCallback(node::Environment*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*) + 97 (node.cc:1140)
    49  libnode.dylib                   0x000000010f891e61 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*) + 161 (node.cc:1154)
    50  Electron Framework              0x000000010ee361be mate::internal::CallEmitWithArgs(v8::Isolate*, v8::Local<v8::Object>, std::__1::vector<v8::Local<v8::Value>, std::__1::allocator<v8::Local<v8::Value> > >*) + 174
    51  Electron Framework              0x000000010ece8d8f v8::Local<v8::Value> mate::EmitEvent<base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, v8::Local<v8::Object>, bool>(v8::Isolate*, v8::Local<v8::Object>, base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, v8::Local<v8::Object> const&, bool const&) + 591
    52  Electron Framework              0x000000010ece8a8a bool mate::EventEmitter::EmitWithEvent<bool>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, v8::Local<v8::Object>, bool const&) + 186
    53  Electron Framework              0x000000010ece89a4 bool mate::EventEmitter::EmitWithSender<bool>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, content::WebContents*, IPC::Message*, bool const&) + 148
    54  Electron Framework              0x000000010ece0bac bool mate::EventEmitter::Emit<bool>(base::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, bool const&) + 44
    55  Electron Framework              0x000000010ecde650 atom::api::App::OnActivate(bool) + 64
    56  Electron Framework              0x000000010edb573d atom::Browser::Activate(bool) + 125
    57  Electron Framework              0x000000010edbff5b -[AtomApplicationDelegate applicationShouldHandleReopen:hasVisibleWindows:] + 59
    58  com.apple.AppKit                0x00007fff909a0928 -[NSApplication(NSAppleEventHandling) _handleAEReopen:] + 357
    59  com.apple.AppKit                0x00007fff905aa385 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 244
    60  com.apple.Foundation            0x00007fff953a6748 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 290
    61  com.apple.Foundation            0x00007fff953a65b9 _NSAppleEventManagerGenericHandler + 102
    62  com.apple.AE                    0x00007fff94b6f34c aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 531
    63  com.apple.AE                    0x00007fff94b6f0c9 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 31
    64  com.apple.AE                    0x00007fff94b6efd3 aeProcessAppleEvent + 295
    65  com.apple.HIToolbox             0x00007fff8fd2dc6e AEProcessAppleEvent + 56
    66  com.apple.AppKit                0x00007fff905a3da2 _DPSNextEvent + 2249
    67  com.apple.AppKit                0x00007fff905a2e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
    68  com.apple.AppKit                0x00007fff90598af3 -[NSApplication run] + 594
    69  libbase.dylib                   0x0000000110ac6cb1 0x110ac3000 + 15537
    70  libbase.dylib                   0x0000000110ac628c 0x110ac3000 + 12940
    71  libbase.dylib                   0x0000000110b14413 base::RunLoop::Run() + 99
    72  libcontent.dylib                0x0000000111f91f7b content::BrowserMainLoop::MainMessageLoopRun() + 155
    73  libcontent.dylib                0x0000000111f91eb5 content::BrowserMainLoop::RunMainMessageLoopParts() + 69
    74  libcontent.dylib                0x0000000111f943a2 0x111f07000 + 578466
    75  libcontent.dylib                0x0000000111f8e13f content::BrowserMain(content::MainFunctionParams const&) + 159
    76  libcontent.dylib                0x0000000111f0b5ec 0x111f07000 + 17900
    77  libcontent.dylib                0x0000000111f0ac46 content::ContentMain(content::ContentMainParams const&) + 54
    78  Electron Framework              0x000000010eccf528 AtomMain + 104
    79  com.github.electron             0x000000010ecc7f1d main + 109 (atom_main.cc:190)
    80  libdyld.dylib                   0x00007fff9040f5c9 start + 1
    
  2. smebberson commented on Sep 17, 2015

    @smebberson

    I've noticed this too. However, I'm not using the new activate event. I am trying to recreate the same window however, much like the code above. The first window creates fine, I close, when the second window is being created, it crashes.

  3. self-assigned this
    on Sep 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions