Copy the callback instead of reference
I don't really see how this could be a problem, likely a bug of VS 2017?
This commit is contained in:
parent
46330ac2a9
commit
bc61f2eafa
4 changed files with 6 additions and 6 deletions
|
@ -29,13 +29,13 @@ class MenuMac : public Menu {
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int positioning_item,
|
int positioning_item,
|
||||||
const base::Closure& callback);
|
base::Closure callback);
|
||||||
void ClosePopupAt(int32_t window_id) override;
|
void ClosePopupAt(int32_t window_id) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Menu;
|
friend class Menu;
|
||||||
|
|
||||||
void OnClosed(int32_t window_id, const base::Closure& callback);
|
void OnClosed(int32_t window_id, base::Closure callback);
|
||||||
|
|
||||||
scoped_nsobject<AtomMenuController> menu_controller_;
|
scoped_nsobject<AtomMenuController> menu_controller_;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int positioning_item,
|
int positioning_item,
|
||||||
const base::Closure& callback) {
|
base::Closure callback) {
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
return;
|
return;
|
||||||
brightray::InspectableWebContents* web_contents =
|
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);
|
popup_controllers_.erase(window_id);
|
||||||
callback.Run();
|
callback.Run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
menu_runners_.erase(window_id);
|
||||||
callback.Run();
|
callback.Run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class MenuViews : public Menu {
|
||||||
void ClosePopupAt(int32_t window_id) override;
|
void ClosePopupAt(int32_t window_id) override;
|
||||||
|
|
||||||
private:
|
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
|
// window ID -> open context menu
|
||||||
std::map<int32_t, std::unique_ptr<views::MenuRunner>> menu_runners_;
|
std::map<int32_t, std::unique_ptr<views::MenuRunner>> menu_runners_;
|
||||||
|
|
Loading…
Reference in a new issue