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

Issue 159130: Fix two crashers with TOOLKIT_VIEWS build:... (Closed)

Created:
11 years, 5 months ago by Ben Goodger (Google)
Modified:
9 years, 6 months ago
Reviewers:
brettw
CC:
chromium-reviews_googlegroups.com, Ben Goodger (Google)
Visibility:
Public.

Description

Fix two crashers with TOOLKIT_VIEWS build: - NativeViewHostGtk::RemovedFromWidget crashes due to WidgetGtk::window_contents_ being NULL... basically when RemovedFromWidget is called from the RootView's dtor, the window_contents_ and widget_ properties of the containing WidgetGtk are NULL. It seems acceptable to not clean up in this case. - TabContentsViewGtk dtor needs to call CloseNow(). This is similar to ~TabContents() calling DestroyWindow on the view's HWND. Without this, the TabContentsViewGtk object was destroyed but the corresponding GtkWidget wasn't, and so subsequent signal handlers would crash. BUG=none TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=21202

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -2 lines) Patch
M chrome/browser/views/tab_contents/tab_contents_view_gtk.cc View 1 1 chunk +4 lines, -0 lines 0 comments Download
M views/controls/native/native_view_host_gtk.cc View 1 chunk +7 lines, -2 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Ben Goodger (Google)
11 years, 5 months ago (2009-07-21 07:12:47 UTC) #1
brettw
11 years, 5 months ago (2009-07-21 14:25:05 UTC) #2
LGTM

On Tue, Jul 21, 2009 at 7:12 AM, <ben@chromium.org> wrote:
> Reviewers: brettw,
>
> Description:
> Fix two crashers with TOOLKIT_VIEWS build:
>
> - NativeViewHostGtk::RemovedFromWidget crashes due to
> WidgetGtk::window_contents_ being NULL... basically when
> RemovedFromWidget is called from the RootView's dtor, the
> window_contents_ and widget_ properties of the containing WidgetGtk are
> NULL. It seems acceptable to not clean up in this case.
> - TabContentsViewGtk dtor needs to call CloseNow(). This is similar to
> ~TabContents() calling DestroyWindow on the view's HWND. Without this,
> the TabContentsViewGtk object was destroyed but the corresponding
> GtkWidget wasn't, and so subsequent signal handlers would crash.
>
> BUG=3Dnone
> TEST=3Dnone
>
> Please review this at http://codereview.chromium.org/159130
>
> SVN Base: svn://svn.chromium.org/chrome/trunk/src/
>
> Affected files:
> =A0M =A0 =A0 chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
> =A0M =A0 =A0 views/controls/native/native_view_host_gtk.cc
>
>
> Index: views/controls/native/native_view_host_gtk.cc
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- views/controls/native/native_view_host_gtk.cc =A0 =A0 =A0 (revision 2=
1157)
> +++ views/controls/native/native_view_host_gtk.cc =A0 =A0 =A0 (working co=
py)
> @@ -87,8 +87,13 @@
> =A0 WidgetGtk* parent_widget =3D GetHostWidget();
> =A0 gtk_widget_hide(host_->native_view());
> =A0 if (parent_widget) {
> - =A0 =A0gtk_container_remove(GTK_CONTAINER(parent_widget->window_content=
s()),
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 host_->native_view());
> + =A0 =A0// We can be called after the contents widget has been destroyed=
, e.g.
> any
> + =A0 =A0// NativeViewHost not removed from the view hierarchy before the=
 window
> is
> + =A0 =A0// closed.
> + =A0 =A0if (GTK_IS_CONTAINER(parent_widget->window_contents())) {
> + =A0 =A0 =A0gtk_container_remove(GTK_CONTAINER(parent_widget->window_con=
tents()),
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 host_->native_view(=
));
> + =A0 =A0}
> =A0 }
> =A0}
>
> Index: chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- chrome/browser/views/tab_contents/tab_contents_view_gtk.cc =A0(revisi=
on
> 21157)
> +++ chrome/browser/views/tab_contents/tab_contents_view_gtk.cc =A0(workin=
g
> copy)
> @@ -96,6 +96,10 @@
> =A0}
>
> =A0TabContentsViewGtk::~TabContentsViewGtk() {
> + =A0// Just deleting the object doesn't destroy the GtkWidget. We need t=
o do
> that
> + =A0// manually, and synchronously, since subsequent signal handlers may
> expect
> + =A0// to locate this object.
> + =A0CloseNow();
> =A0}
>
> =A0void TabContentsViewGtk::CreateView() {
>
>
>

Powered by Google App Engine
This is Rietveld 408576698