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

Issue 510004: Fix crash/leak issue in native_view_host_gtk.cc. (Closed)

Created:
11 years ago by oshima
Modified:
9 years, 6 months ago
Reviewers:
sky
CC:
chromium-reviews_googlegroups.com, ben+cc_chromium.org
Visibility:
Public.

Description

Fix crash/leak issue in native_view_host_gtk.cc. * There are two path to NativeViewDetaching and we need to handle them differently. 1) Via gtk destroy signal. In this case, we should not try to remove the native view from parent because it's being deleted. 2) Through NativeViewHost::Detach(). In this case we need to remove the native view from parent because we added it to parent in NativeViewAttached(). * Fix NativeControlGtk not to destroy the native view because it's now destoryed by NativeViewHostGtk. * Fixed TabContentViewGtk so that it owns the nativew view. The native view was destroyed when Detached. * Added more checks so that test can catch regression. BUG=26154 TEST=The same procedure in bug should now pass. I added several checks that lead tests to fail if this problem exists. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=35220

Patch Set 1 #

Total comments: 8

Patch Set 2 : " #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -16 lines) Patch
M chrome/browser/views/tab_contents/tab_contents_view_gtk.cc View 2 chunks +3 lines, -1 line 0 comments Download
M views/controls/native/native_view_host.h View 1 chunk +4 lines, -0 lines 0 comments Download
M views/controls/native/native_view_host.cc View 4 chunks +12 lines, -4 lines 0 comments Download
M views/controls/native/native_view_host_gtk.h View 2 chunks +1 line, -2 lines 0 comments Download
M views/controls/native/native_view_host_gtk.cc View 1 3 chunks +12 lines, -2 lines 0 comments Download
M views/controls/native/native_view_host_win.h View 1 chunk +1 line, -1 line 0 comments Download
M views/controls/native/native_view_host_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M views/controls/native/native_view_host_wrapper.h View 1 chunk +3 lines, -2 lines 0 comments Download
M views/controls/native_control_gtk.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M views/widget/widget_gtk.cc View 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
oshima
11 years ago (2009-12-22 23:45:36 UTC) #1
sky
http://codereview.chromium.org/510004/diff/1/2 File chrome/browser/views/tab_contents/tab_contents_view_gtk.cc (right): http://codereview.chromium.org/510004/diff/1/2#newcode155 chrome/browser/views/tab_contents/tab_contents_view_gtk.cc:155: gtk_object_ref(GTK_OBJECT(GetNativeView())); Don't you need an unref to balance this ...
11 years ago (2009-12-22 23:55:16 UTC) #2
oshima
http://codereview.chromium.org/510004/diff/1/2 File chrome/browser/views/tab_contents/tab_contents_view_gtk.cc (right): http://codereview.chromium.org/510004/diff/1/2#newcode155 chrome/browser/views/tab_contents/tab_contents_view_gtk.cc:155: gtk_object_ref(GTK_OBJECT(GetNativeView())); On 2009/12/22 23:55:16, sky wrote: > Don't you ...
11 years ago (2009-12-23 00:01:43 UTC) #3
sky
Ok, LGTM. -Scott On 2009/12/23 00:01:43, oshima wrote: > http://codereview.chromium.org/510004/diff/1/2 > File chrome/browser/views/tab_contents/tab_contents_view_gtk.cc (right): > ...
11 years ago (2009-12-23 00:03:49 UTC) #4
oshima
11 years ago (2009-12-23 00:15:02 UTC) #5
Re-running linux_view test (it hit AutoUpdator crash)
I'll check in after linux/linux_view and valgrind test become green.

On 2009/12/23 00:03:49, sky wrote:
> Ok, LGTM.
> 
>   -Scott
> 
> On 2009/12/23 00:01:43, oshima wrote:
> > http://codereview.chromium.org/510004/diff/1/2
> > File chrome/browser/views/tab_contents/tab_contents_view_gtk.cc (right):
> > 
> > http://codereview.chromium.org/510004/diff/1/2#newcode155
> > chrome/browser/views/tab_contents/tab_contents_view_gtk.cc:155:
> > gtk_object_ref(GTK_OBJECT(GetNativeView()));
> > On 2009/12/22 23:55:16, sky wrote:
> > > Don't you need an unref to balance this at some point?
> > 
> > It's destroyed in CloseNew in the destructor.
> > 
> > http://codereview.chromium.org/510004/diff/1/5
> > File views/controls/native/native_view_host_gtk.cc (right):
> > 
> > http://codereview.chromium.org/510004/diff/1/5#newcode80
> > views/controls/native/native_view_host_gtk.cc:80:
> > DCHECK_NE(static_cast<gfx::NativeView>(NULL),
> > gtk_widget_get_parent(host_->native_view()));
> > On 2009/12/22 23:55:16, sky wrote:
> > > lines too long here and 82.
> > 
> > Done.
> > 
> > http://codereview.chromium.org/510004/diff/1/5#newcode209
> > views/controls/native/native_view_host_gtk.cc:209: // fixed_ should not have
> any
> > child this point.
> > On 2009/12/22 23:55:16, sky wrote:
> > > child-> children at
> > 
> > Done.
> > 
> > http://codereview.chromium.org/510004/diff/1/10
> > File views/controls/native_control_gtk.cc (right):
> > 
> > http://codereview.chromium.org/510004/diff/1/10#newcode53
> > views/controls/native_control_gtk.cc:53: // Make sure that Detach destroyed
> > destroy the widget.
> > On 2009/12/22 23:55:16, sky wrote:
> > > remove 'destroy.'
> > 
> > Done.

Powered by Google App Engine
This is Rietveld 408576698