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

Issue 155021: Fix problems with render_widget_host_ being deleted out-of-sync with cocoa_view_. (Closed)

Created:
11 years, 5 months ago by Scott Hess - ex-Googler
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Fix problems with render_widget_host_ being deleted out-of-sync with cocoa_view_. Right after Destroy() is called, render_widget_host_ is deleted. So clear render_widget_host_ and guard calls to render_widget_host_. http://crbug.com/14613 http://crbug.com/13514 http://crbug.com/12725

Patch Set 1 #

Total comments: 2

Patch Set 2 : Style fix. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -12 lines) Patch
M chrome/browser/renderer_host/render_widget_host_view_mac.h View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_host_view_mac.mm View 1 4 chunks +30 lines, -11 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Scott Hess - ex-Googler
jrg because you owned the bug in question previously. If you weren't working on it ...
11 years, 5 months ago (2009-07-02 22:22:48 UTC) #1
Avi (use Gerrit)
LG http://codereview.chromium.org/155021/diff/1/3 File chrome/browser/renderer_host/render_widget_host_view_mac.mm (right): http://codereview.chromium.org/155021/diff/1/3#newcode530 Line 530: if (!renderWidgetHostView_->render_widget_host_) return NO; Are we allowed ...
11 years, 5 months ago (2009-07-02 23:07:03 UTC) #2
Scott Hess - ex-Googler
http://codereview.chromium.org/155021/diff/1/3 File chrome/browser/renderer_host/render_widget_host_view_mac.mm (right): http://codereview.chromium.org/155021/diff/1/3#newcode530 Line 530: if (!renderWidgetHostView_->render_widget_host_) return NO; On 2009/07/02 23:07:04, Avi ...
11 years, 5 months ago (2009-07-02 23:22:08 UTC) #3
John Grabowski
>> jrg because you owned the bug in question previously. I think that was because ...
11 years, 5 months ago (2009-07-06 16:34:55 UTC) #4
Scott Hess - ex-Googler
11 years, 5 months ago (2009-07-06 17:06:57 UTC) #5
On 2009/07/06 16:34:55, John Grabowski wrote:
> >> jrg because you owned the bug in question previously.
> 
> I think that was because a group of crashers were bulk-assigned to me.
> 
> In any case, LGTM with one comment.  How will you make sure future changes to
> this class also perform the NULL check as needed?  Perhaps you can add a unit
> test which sets render_widget_host_ to NULL, then calls all the methods,
making
> sure it doesn't blow up?

I'll add that to my plate, but ... how will I make sure that the unittest calls
all the methods that some crazy future person adds?  At least will catch someone
removing the guard.

Your point has me thinking it might be more reasonable to track down all of the
places where this is being retained, deal with removing their reference, and
change the tests to DCHECK().  Unfortunately, I don't think the existing bugs
would have hit the DCHECKs in normal development.  Maybe both (DCHECK to
hopefully catch un-matched retains, if() guards because they often won't).

Would it make more sense to make render_widget_host_ private, and provide
forwarding methods to encapsulate the test?  Would need some refactoring, but it
probably wouldn't be too bad.  Then the Objective-C code can't make the mistake.

Another option might be to construct an "empty" RenderWidgetHost object for this
case.  Non-obvious how that would work, though.

Powered by Google App Engine
This is Rietveld 408576698