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

Side by Side Diff: views/controls/native/native_view_host_gtk.cc

Issue 159130: Fix two crashers with TOOLKIT_VIEWS build:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/tab_contents/tab_contents_view_gtk.cc ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/controls/native/native_view_host_gtk.h" 5 #include "views/controls/native/native_view_host_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "views/controls/native/native_view_host.h" 10 #include "views/controls/native/native_view_host.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 host_->Layout(); 80 host_->Layout();
81 } 81 }
82 82
83 void NativeViewHostGtk::RemovedFromWidget() { 83 void NativeViewHostGtk::RemovedFromWidget() {
84 if (!host_->native_view()) 84 if (!host_->native_view())
85 return; 85 return;
86 86
87 WidgetGtk* parent_widget = GetHostWidget(); 87 WidgetGtk* parent_widget = GetHostWidget();
88 gtk_widget_hide(host_->native_view()); 88 gtk_widget_hide(host_->native_view());
89 if (parent_widget) { 89 if (parent_widget) {
90 gtk_container_remove(GTK_CONTAINER(parent_widget->window_contents()), 90 // We can be called after the contents widget has been destroyed, e.g. any
91 host_->native_view()); 91 // NativeViewHost not removed from the view hierarchy before the window is
92 // closed.
93 if (GTK_IS_CONTAINER(parent_widget->window_contents())) {
94 gtk_container_remove(GTK_CONTAINER(parent_widget->window_contents()),
95 host_->native_view());
96 }
92 } 97 }
93 } 98 }
94 99
95 void NativeViewHostGtk::InstallClip(int x, int y, int w, int h) { 100 void NativeViewHostGtk::InstallClip(int x, int y, int w, int h) {
96 DCHECK(w > 0 && h > 0); 101 DCHECK(w > 0 && h > 0);
97 102
98 bool has_window = 103 bool has_window =
99 (GTK_WIDGET_FLAGS(host_->native_view()) & GTK_NO_WINDOW) == 0; 104 (GTK_WIDGET_FLAGS(host_->native_view()) & GTK_NO_WINDOW) == 0;
100 if (!has_window) { 105 if (!has_window) {
101 // Clip is only supported on GtkWidgets that have windows. If this becomes 106 // Clip is only supported on GtkWidgets that have windows. If this becomes
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 //////////////////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////////////////
160 // NativeViewHostWrapper, public: 165 // NativeViewHostWrapper, public:
161 166
162 // static 167 // static
163 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( 168 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper(
164 NativeViewHost* host) { 169 NativeViewHost* host) {
165 return new NativeViewHostGtk(host); 170 return new NativeViewHostGtk(host);
166 } 171 }
167 172
168 } // namespace views 173 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/views/tab_contents/tab_contents_view_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698