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

Issue 2798583002: WebUI: prevent WebContent to hold invalid pointer. (Closed)

Created:
3 years, 8 months ago by arthursonzogni
Modified:
3 years, 8 months ago
CC:
chromium-reviews, clamy, Avi (use Gerrit)
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

WebUI: prevent WebContent to hold an invalid pointer. A ConstrainedWebDialogBase creates and own a WebContent. For various reasons, it stores a pointer to itself inside the WebContent. The problem was that the lifetime of the WebContent may exceed the one of ConstrainedWebDialogBase when |release_contents_on_close_| is set to false. The pointer becomes invalid. BUG=704327 Review-Url: https://codereview.chromium.org/2798583002 Cr-Commit-Position: refs/heads/master@{#463318} Committed: https://chromium.googlesource.com/chromium/src/+/e63206f4ef0c18bca991534852acd0193a2de94a

Patch Set 1 : Remove reference to |this| in destructor. #

Patch Set 2 : Remove reference to |this| when the WebContent is no more owned. #

Total comments: 8

Patch Set 3 : prevent ConstrainedWebDialogBase to hold an invalid pointer. #

Total comments: 1

Patch Set 4 : Copy 2806603003 #

Patch Set 5 : Fix compilation on mac #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -36 lines) Patch
M chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h View 1 2 3 4 chunks +10 lines, -5 lines 1 comment Download
M chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc View 1 2 3 6 chunks +23 lines, -13 lines 0 comments Download
M chrome/browser/ui/webui/constrained_web_dialog_ui.h View 1 2 3 3 chunks +6 lines, -4 lines 0 comments Download
M chrome/browser/ui/webui/constrained_web_dialog_ui.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc View 1 2 3 2 chunks +8 lines, -8 lines 0 comments Download
M chrome/browser/ui/webui/print_preview/print_preview_ui.cc View 1 2 3 1 chunk +5 lines, -2 lines 0 comments Download

Messages

Total messages: 54 (34 generated)
arthursonzogni
Hi Lei (@thestig), I am working on a crash with the print preview that happens ...
3 years, 8 months ago (2017-04-04 14:21:52 UTC) #11
arthursonzogni
https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc (right): https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc#newcode52 chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc:52: ConstrainedWebDialogUI::SetConstrainedDelegate(web_contents_.get(), this); FYI: the |this| pointer is given to ...
3 years, 8 months ago (2017-04-04 14:32:15 UTC) #12
Avi (use Gerrit)
https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc (right): https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc#newcode62 chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc:62: ignore_result(web_contents_.release()); (read the other comment first) This if() block ...
3 years, 8 months ago (2017-04-04 14:49:46 UTC) #14
arthursonzogni
Thanks Avi. I can't do what you suggest. Maybe we could store this pointer outside ...
3 years, 8 months ago (2017-04-04 15:17:52 UTC) #15
Lei Zhang
https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc (right): https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc#newcode62 chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc:62: ignore_result(web_contents_.release()); On 2017/04/04 15:17:52, arthursonzogni wrote: > On 2017/04/04 ...
3 years, 8 months ago (2017-04-06 08:27:56 UTC) #16
Lei Zhang
https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc (right): https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc#newcode87 chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc:87: ConstrainedWebDialogUI::ClearConstrainedDelegate(web_contents_.get()); On 2017/04/04 15:17:52, arthursonzogni wrote: > Clearing the ...
3 years, 8 months ago (2017-04-06 09:12:54 UTC) #17
arthursonzogni
On 2017/04/06 08:27:56, Lei Zhang wrote: > https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc > File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc (right): > > https://codereview.chromium.org/2798583002/diff/20001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc#newcode62 ...
3 years, 8 months ago (2017-04-06 09:17:22 UTC) #18
arthursonzogni
On 2017/04/06 09:12:54, Lei Zhang wrote: > Please double check my work: > > Starting ...
3 years, 8 months ago (2017-04-06 09:26:10 UTC) #19
arthursonzogni
On 2017/04/06 09:26:10, arthursonzogni wrote: > > chrome/browser/ui/webui/constrained_web_dialog_ui.cc:120: > > web_ui()->GetWebContents()-> > > Another idea ...
3 years, 8 months ago (2017-04-06 09:36:34 UTC) #20
Lei Zhang
On 2017/04/06 09:36:34, arthursonzogni wrote: > I don't understand very well. The problem is when ...
3 years, 8 months ago (2017-04-06 11:07:43 UTC) #21
arthursonzogni
On 2017/04/06 11:07:43, Lei Zhang wrote: > On 2017/04/06 09:36:34, arthursonzogni wrote: > > I ...
3 years, 8 months ago (2017-04-06 12:57:05 UTC) #22
Lei Zhang
On 2017/04/06 12:57:05, arthursonzogni wrote: > On 2017/04/06 11:07:43, Lei Zhang wrote: > > On ...
3 years, 8 months ago (2017-04-06 22:48:20 UTC) #32
Lei Zhang
https://codereview.chromium.org/2798583002/diff/60001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc (right): https://codereview.chromium.org/2798583002/diff/60001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc#newcode123 chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc:123: web_contents_.release(); This release() makes the ownership of |web_contents_| questionable. ...
3 years, 8 months ago (2017-04-07 00:55:22 UTC) #33
Lei Zhang
On 2017/04/07 00:55:22, Lei Zhang wrote: > https://codereview.chromium.org/2798583002/diff/60001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc > File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc (right): > > https://codereview.chromium.org/2798583002/diff/60001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc#newcode123 ...
3 years, 8 months ago (2017-04-07 01:20:54 UTC) #34
arthursonzogni
On 2017/04/07 01:20:54, Lei Zhang wrote: > On 2017/04/07 00:55:22, Lei Zhang wrote: > > ...
3 years, 8 months ago (2017-04-07 08:27:25 UTC) #35
arthursonzogni
Hi Lei, Do you think this can be committed?
3 years, 8 months ago (2017-04-10 09:18:02 UTC) #38
Lei Zhang
lgtm https://codereview.chromium.org/2798583002/diff/120001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h File chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h (right): https://codereview.chromium.org/2798583002/diff/120001/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h#newcode67 chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h:67: // Pointer to |web_contents_| that remains valid until ...
3 years, 8 months ago (2017-04-10 17:49:48 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2798583002/120001
3 years, 8 months ago (2017-04-10 17:50:15 UTC) #50
commit-bot: I haz the power
Committed patchset #5 (id:120001) as https://chromium.googlesource.com/chromium/src/+/e63206f4ef0c18bca991534852acd0193a2de94a
3 years, 8 months ago (2017-04-10 17:57:36 UTC) #53
arthursonzogni
3 years, 8 months ago (2017-04-11 08:37:26 UTC) #54
Message was sent while issue was closed.
Thanks!

Powered by Google App Engine
This is Rietveld 408576698