From bace4890c8006427ce4b978cde07c5bf0ea5e498 Mon Sep 17 00:00:00 2001 From: Maxine Whitely Date: Fri, 29 Jun 2018 12:21:31 -0700 Subject: [PATCH] fix: tray setContextMenu crash Co-authored-by: Zhuo Lu Co-authored-by: Kristine Zhang --- atom/browser/ui/cocoa/atom_menu_controller.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atom/browser/ui/cocoa/atom_menu_controller.mm b/atom/browser/ui/cocoa/atom_menu_controller.mm index 3e12c90bea8..cecf30ce1c8 100644 --- a/atom/browser/ui/cocoa/atom_menu_controller.mm +++ b/atom/browser/ui/cocoa/atom_menu_controller.mm @@ -123,7 +123,9 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; [menu_ cancelTracking]; isMenuOpen_ = NO; model_->MenuWillClose(); - closeCallback.Run(); + if (!closeCallback.is_null()) { + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, closeCallback); + } } }