From d51eb48985356adc40a55d678b14f0c0a5870ffb Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Fri, 26 Mar 2010 20:27:17 +0000 Subject: Re-apply r42703 which was reverted because of a conflict with another patch that was being reverted: TBR=ananta Views: fix a crash where in the browser actions container. This crash didn't actually affect linux/views (for some reason the RunContextMenu() call seems to never return). BUG=38964 TEST=crash an extension while the context menu for it is showing. original review: http://codereview.chromium.org/1237004/show Review URL: http://codereview.chromium.org/1449001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42813 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/menu/native_menu_gtk.cc | 9 ++++----- views/controls/menu/native_menu_gtk.h | 9 +++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'views') diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index a910a76..71af5c8 100644 --- a/views/controls/menu/native_menu_gtk.cc +++ b/views/controls/menu/native_menu_gtk.cc @@ -105,7 +105,7 @@ void NativeMenuGtk::RunMenuAt(const gfx::Point& point, int alignment) { // Listen for "hide" signal so that we know when to return from the blocking // RunMenuAt call. gint handle_id = - g_signal_connect(menu_, "hide", G_CALLBACK(OnMenuHidden), this); + g_signal_connect(menu_, "hide", G_CALLBACK(OnMenuHiddenThunk), this); // Block until menu is no longer shown by running a nested message loop. MessageLoopForUI::current()->Run(NULL); @@ -121,7 +121,7 @@ void NativeMenuGtk::RunMenuAt(const gfx::Point& point, int alignment) { } void NativeMenuGtk::CancelMenu() { - NOTIMPLEMENTED(); + gtk_widget_hide(menu_); } void NativeMenuGtk::Rebuild() { @@ -177,9 +177,8 @@ gfx::NativeMenu NativeMenuGtk::GetNativeMenu() const { //////////////////////////////////////////////////////////////////////////////// // NativeMenuGtk, private: -// static -void NativeMenuGtk::OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu) { - if (!menu->menu_shown_) { +void NativeMenuGtk::OnMenuHidden(GtkWidget* widget) { + if (!menu_shown_) { // This indicates we don't have a menu open, and should never happen. NOTREACHED(); return; diff --git a/views/controls/menu/native_menu_gtk.h b/views/controls/menu/native_menu_gtk.h index 2c69ba3..78d03ec 100644 --- a/views/controls/menu/native_menu_gtk.h +++ b/views/controls/menu/native_menu_gtk.h @@ -1,12 +1,13 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ #define VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ #include +#include "app/gtk_signal.h" #include "base/task.h" #include "views/controls/menu/menu_wrapper.h" @@ -38,7 +39,7 @@ class NativeMenuGtk : public MenuWrapper { virtual gfx::NativeMenu GetNativeMenu() const; private: - static void OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu); + CHROMEGTK_CALLBACK_0(NativeMenuGtk, void, OnMenuHidden); void AddSeparatorAt(int index); GtkWidget* AddMenuItemAt(int index, GtkRadioMenuItem* radio_group, -- cgit v1.1