Closed
Bug 265289
Opened 20 years ago
Closed 20 years ago
nsDocLoader comparing weakrefs
Categories
(Core :: DOM: Navigation, defect)
Core
DOM: Navigation
Tracking
()
RESOLVED
FIXED
People
(Reporter: jhpedemonte, Assigned: adamlock)
Details
Attachments
(1 file)
3.89 KB,
patch
|
benjamin
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
The function nsDocLoaderImpl::GetListenerInfo compares its parameter (an nsIWeakReference*) to a saved nsWeakPtr. But this seems wrong to me. The two weakref instances come from different calls to |do_GetWeakReference|, so how does it work if we compare them to each other? Should we not be comparing the referent? For me, at least, it is causing a failure, since the weakrefs never match up, and nsWebBrowser::RemoveWebBrowserListener() returns an error (since nsDocLoaderImpl::RemoveProgressListener() failed). I was able to work around this by getting the referent for each weakref and comparing those, but I'm not sure if that is the right solution.
Comment 1•20 years ago
|
||
That is the correct solution. Be sure that you get the referent as nsISupports*, not any other interface*, since only nsISupports* is guaranteed to have pointer->object identity per the COM rules.
Comment 2•20 years ago
|
||
> That is the correct solution. Be sure that you get the referent as nsISupports*,
> not any other interface*, since only nsISupports* is guaranteed to have
> pointer->object identity per the COM rules.
nsIWebProgressListener should be just as good... there cannot be two different
nsIWebProgressListener pointers to the same object. IOW, it should be enough to
take aListener passed to Add/RemoveProgressListener and compare that to the
result of QueryReferent(NS_GET_IID(nsIWebProgressListener)) on the list of
stored progress listeners weak refs.
Comment 3•20 years ago
|
||
I stand corrected. A tearoff could be used to implement nsIWebProgressListener, so it is necessary to compare nsISupports instances as bsmedberg said. My bad.
Reporter | ||
Comment 4•20 years ago
|
||
Reporter | ||
Updated•20 years ago
|
Attachment #162745 -
Flags: review?(bsmedberg)
Updated•20 years ago
|
Attachment #162745 -
Flags: review?(bsmedberg) → review+
Comment 5•20 years ago
|
||
Comment on attachment 162745 [details] [diff] [review] patch sr=darin
Attachment #162745 -
Flags: superreview+
Comment 6•20 years ago
|
||
(In reply to comment #3) > I stand corrected. A tearoff could be used to implement nsIWebProgressListener, or code could implement two interfaces which both derive from nsIWPL - then you could also have different nsIWPL pointers for the same object.
Comment 7•20 years ago
|
||
> or code could implement two interfaces which both derive from nsIWPL - then you
> could also have different nsIWPL pointers for the same object.
true true!
Reporter | ||
Comment 8•20 years ago
|
||
Checked into trunk.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•