Skip to content

fix: don't crash on tray.setContextMenu(null) - #14322

Merged
ckerr merged 1 commit into
masterfrom
miniak/tray-null-menu
Aug 27, 2018
Merged

ckerr merged 1 commit into
masterfrom
miniak/tray-null-menu

Conversation

@miniak

@miniak miniak commented Aug 27, 2018 •

Copy link
Copy Markdown
Contributor
Description of Change

Fixes #14188

Checklist
  • PR description included and stakeholders cc'd
  • npm test passes
  • tests are changed or added
  • relevant documentation is changed or added
  • PR title follows semantic commit guidelines
Release Notes

Notes: Fixed crash on tray.setContextMenu(null).

@miniak
miniak requested review from a team August 27, 2018 02:10
@miniak miniak self-assigned this Aug 27, 2018
@miniak
miniak force-pushed the miniak/tray-null-menu branch from 2963698 to a13e578 Compare August 27, 2018 02:26
@miniak

miniak commented Aug 27, 2018

Copy link
Copy Markdown
Contributor Author

@ckerr, @codebytere can you please review?

@miniak
miniak force-pushed the miniak/tray-null-menu branch from a13e578 to 764c8ac Compare August 27, 2018 12:31
@miniak miniak changed the title fix: don't crash on tray.setContextMenu(null) [wip] fix: don't crash on tray.setContextMenu(null) Aug 27, 2018

@alexeykuzmin alexeykuzmin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

void Tray::SetContextMenu(v8::Isolate* isolate, mate::Handle<Menu> menu) {
menu_.Reset(isolate, menu.ToV8());
tray_icon_->SetContextMenu(menu->model());
tray_icon_->SetContextMenu(menu.IsEmpty() ? nullptr : menu->model());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can menu->model() just return a nullptr when it's empty?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

menu itself is empty reference

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right.

@miniak miniak changed the title [wip] fix: don't crash on tray.setContextMenu(null) fix: don't crash on tray.setContextMenu(null) Aug 27, 2018
@codebytere

codebytere commented Aug 27, 2018 •

Copy link
Copy Markdown
Member

I'd like eventually to move away from using tray.setContextMenu(null) and Menu.setApplicationMenu(null)to unset menus in favor of something like tray.removeContextMenu(), but that's out of scope for this PR i'd say.

@ckerr

ckerr commented Aug 27, 2018

Copy link
Copy Markdown
Member

Merging this PR -- these CI failures are known glitches & are not related to this PR.

@ckerr
ckerr merged commit a08ca9d into master Aug 27, 2018
@release-clerk

release-clerk Bot commented Aug 27, 2018

Copy link
Copy Markdown

Release Notes Persisted

Fixed crash on tray.setContextMenu(null).

@ckerr
ckerr deleted the miniak/tray-null-menu branch August 27, 2018 16:58
@trop

trop Bot commented Aug 27, 2018

Copy link
Copy Markdown
Contributor

We have automatically backported this PR to "1-8-x", please check out #14329

@trop

trop Bot commented Aug 27, 2018

Copy link
Copy Markdown
Contributor

We have automatically backported this PR to "2-0-x", please check out #14330

@trop

trop Bot commented Aug 27, 2018

Copy link
Copy Markdown
Contributor

We have automatically backported this PR to "3-0-x", please check out #14331

@trop trop Bot added merged/3-0-x and removed target/3-0-x labels Aug 27, 2018
@deepak1556 deepak1556 mentioned this pull request Aug 28, 2018
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants