WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
86300
RenderView::selectionBounds and RenderView::setSelection use maps with raw pointers that should be OwnPtr
https://bugs.webkit.org/show_bug.cgi?id=86300
Summary
RenderView::selectionBounds and RenderView::setSelection use maps with raw po...
Darin Adler
Reported
2012-05-12 08:34:13 PDT
RenderView::selectionBounds uses some maps with raw pointers that should be OwnPtr instead
Attachments
Patch
(9.79 KB, patch)
2012-05-12 08:36 PDT
,
Darin Adler
eric
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2012-05-12 08:36:08 PDT
Created
attachment 141579
[details]
Patch
Eric Seidel (no email)
Comment 2
2012-05-12 11:07:53 PDT
Comment on
attachment 141579
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141579&action=review
LGTM. Hopefully the timings on these deletions don't matter. I didn't look closely at what RenderSelectionInfo to see if we're now extending the life of objects in ways which could interact with later parts of these functions.
> Source/WebCore/ChangeLog:3 > + RenderView::selectionBounds and RenderView::setSelectoin use maps with raw pointers that should be OwnPtr
"selectoin"
> Source/WebCore/rendering/RenderView.cpp:414 > + OwnPtr<RenderSelectionInfo>& blockInfo = selectedObjects.add(cb, nullptr).iterator->second;
I thought someone had fixed our HashMap code to not use std:pair, and thus have ->key and ->value instead of first/second.
> Source/WebCore/rendering/RenderView.cpp:417 > + blockInfo = adoptPtr(new RenderSelectionInfo(cb, clipToVisibleContent));
I presume that its' kosher to fill the iterator here, since as far as the hashmap is concerned, it already added the value "nullPtr" if something didn't previously exist for that key?
Darin Adler
Comment 3
2012-05-13 15:50:42 PDT
Comment on
attachment 141579
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141579&action=review
>> Source/WebCore/rendering/RenderView.cpp:414 >> + OwnPtr<RenderSelectionInfo>& blockInfo = selectedObjects.add(cb, nullptr).iterator->second; > > I thought someone had fixed our HashMap code to not use std:pair, and thus have ->key and ->value instead of first/second.
I thought so too. This is an old patch, so it’s not surprising that this was written the old way. But given that, I wonder why this patch is building fine in EWS.
>> Source/WebCore/rendering/RenderView.cpp:417 >> + blockInfo = adoptPtr(new RenderSelectionInfo(cb, clipToVisibleContent)); > > I presume that its' kosher to fill the iterator here, since as far as the hashmap is concerned, it already added the value "nullPtr" if something didn't previously exist for that key?
Yes, a nullptr has been added. We have a reference to the value in the map that we did get by dereferencing the iterator. And it’s legal to change the value in the map by assigning to it.
Darin Adler
Comment 4
2012-05-13 16:38:25 PDT
Comment on
attachment 141579
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141579&action=review
>>> Source/WebCore/rendering/RenderView.cpp:414 >>> + OwnPtr<RenderSelectionInfo>& blockInfo = selectedObjects.add(cb, nullptr).iterator->second; >> >> I thought someone had fixed our HashMap code to not use std:pair, and thus have ->key and ->value instead of first/second. > > I thought so too. This is an old patch, so it’s not surprising that this was written the old way. But given that, I wonder why this patch is building fine in EWS.
No, apparently HashMap has not been changed yet.
Darin Adler
Comment 5
2012-05-13 16:38:58 PDT
Committed
r116906
: <
http://trac.webkit.org/changeset/116906
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug