summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 17:48:06 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 17:48:06 +0000
commite86f9c0b06649482096d09d86d332c3717bf8481 (patch)
tree9155222141f234181579f5872e272fee4d4e9c8a /views
parentfc256f3c6e4b3d0d20e449f112bf4ab900ac36a3 (diff)
downloadchromium_src-e86f9c0b06649482096d09d86d332c3717bf8481.zip
chromium_src-e86f9c0b06649482096d09d86d332c3717bf8481.tar.gz
chromium_src-e86f9c0b06649482096d09d86d332c3717bf8481.tar.bz2
Assertion failure fix
* Closing a submenu was hitting NOTREACHED in OnMenuHidden. * Changed to register OnMenuHidden callback only when we're about to open the menu, then disconnect it when closed. This is safer as the same menu can be used as submenu (although that's probably not great style) Review URL: http://codereview.chromium.org/328002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/native_menu_gtk.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc
index b5e59c0..a50b9b8 100644
--- a/views/controls/menu/native_menu_gtk.cc
+++ b/views/controls/menu/native_menu_gtk.cc
@@ -86,10 +86,15 @@ void NativeMenuGtk::RunMenuAt(const gfx::Point& point, int alignment) {
DCHECK(!menu_shown_);
menu_shown_ = true;
+ // Listen for "hide" signal so that we know when to return from the blocking
+ // RunMenuAt call.
+ gint handle_id =
+ g_signal_connect(G_OBJECT(menu_), "hide", G_CALLBACK(OnMenuHidden), this);
// Block until menu is no longer shown by running a nested message loop.
MessageLoopForUI::current()->Run(NULL);
+ g_signal_handler_disconnect(G_OBJECT(menu_), handle_id);
menu_shown_ = false;
}
@@ -223,9 +228,6 @@ void NativeMenuGtk::ResetMenu() {
if (menu_)
gtk_widget_destroy(menu_);
menu_ = gtk_menu_new();
- // Listen for "hide" signal so that we know when to return from the blocking
- // RunMenuAt call.
- g_signal_connect(G_OBJECT(menu_), "hide", G_CALLBACK(OnMenuHidden), this);
}
// static