summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/gtk/bookmark_manager_browsertest.cc10
-rw-r--r--views/focus/accelerator_handler_gtk.cc6
2 files changed, 15 insertions, 1 deletions
diff --git a/chrome/browser/gtk/bookmark_manager_browsertest.cc b/chrome/browser/gtk/bookmark_manager_browsertest.cc
index 485a661d..1d8b8b0 100644
--- a/chrome/browser/gtk/bookmark_manager_browsertest.cc
+++ b/chrome/browser/gtk/bookmark_manager_browsertest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_window.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/gtk/bookmark_manager_gtk.h"
#include "chrome/test/in_process_browser_test.h"
@@ -80,4 +81,13 @@ IN_PROC_BROWSER_TEST_F(BookmarkManagerTest, Crash) {
manager_->SelectInTree(model_->GetBookmarkBarNode(), true);
CleanUp();
+#if defined(TOOLKIT_VIEWS)
+ // The test fails on toolkit_views build without the following
+ // cleanup code. This is because the bookmark bar view refuses to
+ // be destroyed by a bookmark model when the BrowserProcessImpl
+ // destroys the bookmark bar model.
+ // TODO(oshima): http://crbug/28046.
+ browser()->window()->Close();
+ MessageLoopForUI::current()->RunAllPending();
+#endif
}
diff --git a/views/focus/accelerator_handler_gtk.cc b/views/focus/accelerator_handler_gtk.cc
index bb519bb..1ff5d81 100644
--- a/views/focus/accelerator_handler_gtk.cc
+++ b/views/focus/accelerator_handler_gtk.cc
@@ -5,7 +5,6 @@
#include <gtk/gtk.h>
#include "views/focus/accelerator_handler.h"
-
#include "views/focus/focus_manager.h"
#include "views/widget/widget_gtk.h"
#include "views/window/window_gtk.h"
@@ -26,6 +25,11 @@ bool AcceleratorHandler::Dispatch(GdkEvent* event) {
GdkWindow* window = gdk_window_get_toplevel(key_event->window);
gpointer ptr;
gdk_window_get_user_data(window, &ptr);
+ if (!ptr && !gdk_window_is_visible(window)) {
+ // The window is destroyed while we're handling key events.
+ gtk_main_do_event(event);
+ return true;
+ }
DCHECK(ptr); // The top-level window is expected to always be associated
// with the top-level gtk widget.
WindowGtk* widget =