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

Crash when pressing ALT and setMenu is called with Menu.buildFromTemplate([]) #23282

Closed
3 tasks done
dezsiszabi opened this issue Apr 25, 2020 · 0 comments · Fixed by #23308
Closed
3 tasks done

Crash when pressing ALT and setMenu is called with Menu.buildFromTemplate([]) #23282

dezsiszabi opened this issue Apr 25, 2020 · 0 comments · Fixed by #23308

Comments

@dezsiszabi
Copy link

dezsiszabi commented Apr 25, 2020

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:

    • v8.2.3
  • Operating System:

    • Windows 10 (64 bit)
  • Last Known Working Electron version:

    • N/A

Expected Behavior

Doesn't crash

Actual Behavior

Crashes

To Reproduce

const { app, BrowserWindow, Menu } = require('electron');

function createWindow () {
  let win = new BrowserWindow();
  win.setMenu(Menu.buildFromTemplate([]));
  win.loadFile('index.html');
}

app.whenReady().then(createWindow);

Press ALT in the window that pops up. Result: electron.exe crashes. Probably Menu.buildFromTemplate shouldn't be called with an empty array... BUT, this still shouldn't crash the application in my opinion.

Call stack from crashdump

electron.exe!views::FocusSearch::FindNextFocusableViewImpl(views::View * starting_view, views::FocusSearch::StartingViewPolicy check_starting_view, bool can_go_up, bool can_go_down, views::FocusSearch::AnchoredDialogPolicy can_go_into_anchored_dialog, int skip_group_id, base::internal::flat_tree<views::View *,views::View *,base::internal::GetKeyFromValueIdentity<views::View *>,std::__1::less<void>> * seen_views, views::FocusTraversable * * focus_traversable, views::View * * focus_traversable_view) Line 186	C++
electron.exe!views::FocusSearch::FindNextFocusableView(views::View * starting_view, views::FocusSearch::SearchDirection search_direction, views::FocusSearch::TraversalDirection traversal_direction, views::FocusSearch::StartingViewPolicy check_starting_view, views::FocusSearch::AnchoredDialogPolicy can_go_into_anchored_dialog, views::FocusTraversable * * focus_traversable, views::View * * focus_traversable_view) Line 63	C++
[Inline Frame] electron.exe!views::AccessiblePaneView::GetFirstFocusableChild() Line 138	C++
electron.exe!views::AccessiblePaneView::SetPaneFocus(views::View * initial_focus) Line 72	C++
electron.exe!electron::MenuBar::SetPaneFocus(views::View * initial_focus) Line 204	C++
electron.exe!electron::RootView::HandleKeyEvent(const content::NativeWebKeyboardEvent & event) Line 153	C++
electron.exe!electron::CommonWebContentsDelegate::HandleKeyboardEvent(content::WebContents * source, const content::NativeWebKeyboardEvent & event) Line 37	C++
electron.exe!content::RenderWidgetHostImpl::OnKeyboardEventAck(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> & event, content::InputEventAckSource ack_source, content::InputEventAckState ack_result) Line 2126	C++
[Inline Frame] electron.exe!base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>::Run(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> & args, content::InputEventAckSource args, content::InputEventAckState args) Line 98	C++
electron.exe!content::InputRouterImpl::KeyboardEventHandled(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> & event, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)> event_result_callback, content::InputEventAckSource source, const ui::LatencyInfo & latency, content::InputEventAckState state, const base::Optional<ui::DidOverscrollParams> & overscroll, const base::Optional<cc::TouchAction> & touch_action) Line 566	C++
[Inline Frame] electron.exe!base::internal::FunctorTraits<void (content::InputRouterImpl::*)(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>, content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &),void>::Invoke(void(content::InputRouterImpl::*)(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>, content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &) method, base::WeakPtr<content::InputRouterImpl> && receiver_ptr, content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> && args, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)> && args, content::InputEventAckSource && args, const ui::LatencyInfo & args, content::InputEventAckState && args, const base::Optional<ui::DidOverscrollParams> &) Line 498	C++
[Inline Frame] electron.exe!base::internal::InvokeHelper<1,void>::MakeItSo(void(content::InputRouterImpl::*)(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>, content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &) && functor, base::WeakPtr<content::InputRouterImpl> && weak_ptr, content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> && args, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)> && args, content::InputEventAckSource && args, const ui::LatencyInfo & args, content::InputEventAckState && args, const base::Optional<ui::DidOverscrollParams> &) Line 618	C++
[Inline Frame] electron.exe!base::internal::Invoker<base::internal::BindState<void (content::InputRouterImpl::*)(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>, content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &),base::WeakPtr<content::InputRouterImpl>,content::EventWithLatencyInfo<content::NativeWebKeyboardEvent>,base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>>,void (content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &)>::RunImpl(void(content::InputRouterImpl::*)(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>, content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &) && functor, std::__1::tuple<base::WeakPtr<content::InputRouterImpl>,content::EventWithLatencyInfo<content::NativeWebKeyboardEvent>,base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>> && bound, std::__1::integer_sequence<unsigned long long,0,1,2>, content::InputEventAckSource && unbound_args, const ui::LatencyInfo & unbound_args, content::InputEventAckState && unbound_args, const base::Optional<ui::DidOverscrollParams> &) Line 671	C++
electron.exe!base::internal::Invoker<base::internal::BindState<void (content::InputRouterImpl::*)(const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>, content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &),base::WeakPtr<content::InputRouterImpl>,content::EventWithLatencyInfo<content::NativeWebKeyboardEvent>,base::OnceCallback<void (const content::EventWithLatencyInfo<content::NativeWebKeyboardEvent> &, content::InputEventAckSource, content::InputEventAckState)>>,void (content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &)>::RunOnce(base::internal::BindStateBase * base, content::InputEventAckSource unbound_args, const ui::LatencyInfo & unbound_args, content::InputEventAckState unbound_args, const base::Optional<ui::DidOverscrollParams> & unbound_args, const base::Optional<cc::TouchAction> & unbound_args) Line 644	C++
[Inline Frame] electron.exe!base::OnceCallback<void (content::InputEventAckSource, const ui::LatencyInfo &, content::InputEventAckState, const base::Optional<ui::DidOverscrollParams> &, const base::Optional<cc::TouchAction> &)>::Run(content::InputEventAckSource args, const ui::LatencyInfo & args, content::InputEventAckState args, const base::Optional<ui::DidOverscrollParams> & args, const base::Optional<cc::TouchAction> & args) Line 98	C++
electron.exe!content::mojom::WidgetInputHandler_DispatchEvent_ForwardToCallback::Accept(mojo::Message * message) Line 1969	C++
electron.exe!mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message * message) Line 549	C++
electron.exe!mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::internal::MultiplexRouter::MessageWrapper * message_wrapper, mojo::internal::MultiplexRouter::ClientCallBehavior client_call_behavior, base::SequencedTaskRunner * current_task_runner) Line 882	C++
electron.exe!mojo::internal::MultiplexRouter::Accept(mojo::Message * message) Line 608	C++
electron.exe!mojo::Connector::DispatchMessageW(mojo::Message message) Line 538	C++
electron.exe!mojo::Connector::ReadAllAvailableMessages() Line 627	C++
[Inline Frame] electron.exe!base::RepeatingCallback<void (unsigned int, const mojo::HandleSignalsState &)>::Run(unsigned int args, const mojo::HandleSignalsState & args) Line 132	C++
electron.exe!mojo::SimpleWatcher::OnHandleReady(int watch_id, unsigned int result, const mojo::HandleSignalsState & state) Line 293	C++
[Inline Frame] electron.exe!base::OnceCallback<void ()>::Run() Line 98	C++
electron.exe!base::TaskAnnotator::RunTask(const char * trace_event_name, base::PendingTask * pending_task) Line 142	C++
electron.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow * continuation_lazy_now, bool * ran_task) Line 366	C++
electron.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoSomeWork() Line 221	C++
electron.exe!base::MessagePumpForUI::DoRunLoop() Line 218	C++
electron.exe!base::MessagePumpWin::Run(base::MessagePump::Delegate * delegate) Line 76	C++
electron.exe!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool application_tasks_allowed, base::TimeDelta timeout) Line 471	C++
electron.exe!base::RunLoop::Run() Line 158	C++
electron.exe!content::BrowserMainLoop::MainMessageLoopRun() Line 1537	C++
electron.exe!content::BrowserMainLoop::RunMainMessageLoopParts() Line 1064	C++
electron.exe!content::BrowserMainRunnerImpl::Run() Line 151	C++
electron.exe!content::BrowserMain(const content::MainFunctionParams & parameters) Line 47	C++
electron.exe!content::RunBrowserProcessMain(const content::MainFunctionParams & main_function_params, content::ContentMainDelegate * delegate) Line 527	C++
electron.exe!content::ContentMainRunnerImpl::RunServiceManager(content::MainFunctionParams & main_params, bool start_service_manager_only) Line 960	C++
electron.exe!content::ContentMainRunnerImpl::Run(bool start_service_manager_only) Line 872	C++
electron.exe!service_manager::Main(const service_manager::MainParams & params) Line 423	C++
electron.exe!content::ContentMain(const content::ContentMainParams & params) Line 19	C++
electron.exe!wWinMain(HINSTANCE__ * instance, HINSTANCE__ *, wchar_t * cmd, int) Line 168	C++
[External Code]
@dezsiszabi dezsiszabi changed the title Crash when Crash when pressing ALT and setMenu is called with Menu.buildFromTemplate([]) Apr 25, 2020
@dezsiszabi dezsiszabi changed the title Crash when pressing ALT and setMenu is called with Menu.buildFromTemplate([]) Crash when pressing ALT and setMenu is called with Menu.buildFromTemplate([]) Apr 25, 2020
@codebytere codebytere self-assigned this Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants