Skip to content

Commit

Permalink
fix: prevent menu gc during popup (#20785)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere authored and zcbenz committed Oct 29, 2019
1 parent cff63d3 commit f77bd19
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions shell/browser/api/atom_api_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "shell/browser/api/atom_api_top_level_window.h"
#include "shell/browser/api/trackable_object.h"
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/common/api/locker.h"

namespace electron {

Expand Down
3 changes: 3 additions & 0 deletions shell/browser/api/atom_api_menu_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
int y,
int positioning_item,
base::Closure callback) {
mate::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());

if (!native_window)
return;
NSWindow* nswindow = native_window->GetNativeWindow().GetNativeNSWindow();
Expand Down
3 changes: 3 additions & 0 deletions shell/browser/api/atom_api_menu_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ void MenuViews::PopupAt(TopLevelWindow* window,
int y,
int positioning_item,
const base::Closure& callback) {
mate::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());

auto* native_window = static_cast<NativeWindowViews*>(window->window());
if (!native_window)
return;
Expand Down

0 comments on commit f77bd19

Please sign in to comment.