Closed
Bug 227489
Opened 22 years ago
Closed 20 years ago
nsIWidget::GetParent and GetChildren should not return raw addrefed pointers
Categories
(Core :: Web Painting, defect)
Core
Web Painting
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(1 file)
|
31.28 KB,
patch
|
roc
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
GetParent() and GetChildren() should return already_AddRefed (or GetParent()
should maybe just return a weak pointer).
Updated•22 years ago
|
OS: Linux → All
Hardware: PC → All
Updated•22 years ago
|
Whiteboard: [good first bug]
Summary: nsIWidget should not return raw addrefed pointers → nsIWidget::GetParent and GetChildren should not return raw addrefed pointers
*** Bug 251527 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 2•21 years ago
|
||
Note that GetChildren() is gone. All that's left is GetParent().
Comment 3•20 years ago
|
||
So..
Instead of:
nsIWidget* nsWidget::GetParent(void)
{
nsIWidget *ret;
ret = mParent;
NS_IF_ADDREF(ret);
return ret;
}
do we want:
already_AddRefed<nsIWidget> nsWidget::GetParent()
{
return do_QueryReferent(mParent);
}
, assuming mParent is an nsWeakPtr?
| Assignee | ||
Comment 4•20 years ago
|
||
No, we want:
nsIWidget* GetParent() const { return mParent; }
(mParent is not an nsWeakPtr).
Then we need to find all callers of this method and audit them to make sure that
nothing bad will happen. This is the part that's pretty nontrivial to do. :(
Comment 5•20 years ago
|
||
(In reply to comment #4)
> Then we need to find all callers of this method and audit them to make sure that
> nothing bad will happen. This is the part that's pretty nontrivial to do. :(
Okay. Should the callers have a strong reference to the returned pointer while
they're using it?
| Assignee | ||
Comment 6•20 years ago
|
||
Depends on the caller. All the ones that can get away with holding a weak ref
(i.e. all the ones that don't do anything that could destroy the widget) should
do so.
| Assignee | ||
Comment 7•20 years ago
|
||
I looked at all GetParent() callers in the tree, and things look ok. Note that this fixes an accessibility leak...
Attachment #215193 -
Flags: superreview?(roc)
Attachment #215193 -
Flags: review?(roc)
Attachment #215193 -
Flags: superreview?(roc)
Attachment #215193 -
Flags: superreview+
Attachment #215193 -
Flags: review?(roc)
Attachment #215193 -
Flags: review+
| Assignee | ||
Comment 8•20 years ago
|
||
roc, could you possibly land that for me? I won't have a chance to watch the tree for at least 5 days, maybe more, and this sort of thing rots easily. :(
I'll land it for you.
(In reply to comment #7)
> Note that this fixes an accessibility leak...
Where?
| Assignee | ||
Comment 11•20 years ago
|
||
| Assignee | ||
Updated•20 years ago
|
Assignee: roc → bzbarsky
Whiteboard: [good first bug]
Target Milestone: --- → mozilla1.9alpha
| Assignee | ||
Comment 12•20 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Component: Layout: View Rendering → Layout: Web Painting
You need to log in
before you can comment on or make changes to this bug.
Description
•