Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: views/widget/widget_gtk.cc

Issue 1664001: Fixes possible crash if the window hosting a menu was closed while the (Closed)
Patch Set: Incorporated review feedback Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « views/views_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/widget/widget_gtk.h" 5 #include "views/widget/widget_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <X11/extensions/shape.h> 9 #include <X11/extensions/shape.h>
10 10
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 GdkEventVisibility* event) { 982 GdkEventVisibility* event) {
983 return false; 983 return false;
984 } 984 }
985 985
986 gboolean WidgetGtk::OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event) { 986 gboolean WidgetGtk::OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event) {
987 HandleGrabBroke(); 987 HandleGrabBroke();
988 return false; // To let other widgets get the event. 988 return false; // To let other widgets get the event.
989 } 989 }
990 990
991 void WidgetGtk::OnGrabNotify(GtkWidget* widget, gboolean was_grabbed) { 991 void WidgetGtk::OnGrabNotify(GtkWidget* widget, gboolean was_grabbed) {
992 if (!window_contents_)
993 return; // Grab broke after window destroyed, don't try processing it.
994
992 gtk_grab_remove(window_contents_); 995 gtk_grab_remove(window_contents_);
993 HandleGrabBroke(); 996 HandleGrabBroke();
994 } 997 }
995 998
996 void WidgetGtk::OnDestroy(GtkWidget* object) { 999 void WidgetGtk::OnDestroy(GtkWidget* object) {
997 // Note that this handler is hooked to GtkObject::destroy. 1000 // Note that this handler is hooked to GtkObject::destroy.
998 widget_ = window_contents_ = NULL; 1001 widget_ = window_contents_ = NULL;
999 if (delete_on_destroy_) { 1002 if (delete_on_destroy_) {
1000 // Delays the deletion of this WidgetGtk as we want its children to have 1003 // Delays the deletion of this WidgetGtk as we want its children to have
1001 // access to it when destroyed. 1004 // access to it when destroyed.
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 1372
1370 // static 1373 // static
1371 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) { 1374 Widget* Widget::GetWidgetFromNativeWindow(gfx::NativeWindow native_window) {
1372 gpointer raw_widget = g_object_get_data(G_OBJECT(native_window), kWidgetKey); 1375 gpointer raw_widget = g_object_get_data(G_OBJECT(native_window), kWidgetKey);
1373 if (raw_widget) 1376 if (raw_widget)
1374 return reinterpret_cast<Widget*>(raw_widget); 1377 return reinterpret_cast<Widget*>(raw_widget);
1375 return NULL; 1378 return NULL;
1376 } 1379 }
1377 1380
1378 } // namespace views 1381 } // namespace views
OLDNEW
« no previous file with comments | « views/views_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698