From bc61f2eafad194013375b2bd054085c131816511 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Jan 2018 19:28:08 +0900 Subject: [PATCH] Copy the callback instead of reference I don't really see how this could be a problem, likely a bug of VS 2017? --- atom/browser/api/atom_api_menu_mac.h | 4 ++-- atom/browser/api/atom_api_menu_mac.mm | 4 ++-- atom/browser/api/atom_api_menu_views.cc | 2 +- atom/browser/api/atom_api_menu_views.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/atom/browser/api/atom_api_menu_mac.h b/atom/browser/api/atom_api_menu_mac.h index cffd7370cb83..8edef08e7898 100644 --- a/atom/browser/api/atom_api_menu_mac.h +++ b/atom/browser/api/atom_api_menu_mac.h @@ -29,13 +29,13 @@ class MenuMac : public Menu { int x, int y, int positioning_item, - const base::Closure& callback); + base::Closure callback); void ClosePopupAt(int32_t window_id) override; private: friend class Menu; - void OnClosed(int32_t window_id, const base::Closure& callback); + void OnClosed(int32_t window_id, base::Closure callback); scoped_nsobject menu_controller_; diff --git a/atom/browser/api/atom_api_menu_mac.mm b/atom/browser/api/atom_api_menu_mac.mm index 0b7713bb020b..cb5b9af26d8f 100644 --- a/atom/browser/api/atom_api_menu_mac.mm +++ b/atom/browser/api/atom_api_menu_mac.mm @@ -44,7 +44,7 @@ void MenuMac::PopupOnUI(const base::WeakPtr& native_window, int x, int y, int positioning_item, - const base::Closure& callback) { + base::Closure callback) { if (!native_window) return; brightray::InspectableWebContents* web_contents = @@ -124,7 +124,7 @@ void MenuMac::ClosePopupAt(int32_t window_id) { } } -void MenuMac::OnClosed(int32_t window_id, const base::Closure& callback) { +void MenuMac::OnClosed(int32_t window_id, base::Closure callback) { popup_controllers_.erase(window_id); callback.Run(); } diff --git a/atom/browser/api/atom_api_menu_views.cc b/atom/browser/api/atom_api_menu_views.cc index f7213cf070cb..6bfc850e45f5 100644 --- a/atom/browser/api/atom_api_menu_views.cc +++ b/atom/browser/api/atom_api_menu_views.cc @@ -74,7 +74,7 @@ void MenuViews::ClosePopupAt(int32_t window_id) { } } -void MenuViews::OnClosed(int32_t window_id, const base::Closure& callback) { +void MenuViews::OnClosed(int32_t window_id, base::Closure callback) { menu_runners_.erase(window_id); callback.Run(); } diff --git a/atom/browser/api/atom_api_menu_views.h b/atom/browser/api/atom_api_menu_views.h index df8285ad9ac4..64b9590c1b73 100644 --- a/atom/browser/api/atom_api_menu_views.h +++ b/atom/browser/api/atom_api_menu_views.h @@ -26,7 +26,7 @@ class MenuViews : public Menu { void ClosePopupAt(int32_t window_id) override; private: - void OnClosed(int32_t window_id, const base::Closure& callback); + void OnClosed(int32_t window_id, base::Closure callback); // window ID -> open context menu std::map> menu_runners_;