Open Bug 998092 Opened 11 years ago Updated 2 years ago

do_QueryObject abuse in PeerConnectionImpl.cpp

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

People

(Reporter: neil, Unassigned)

References

Details

The code nsRefPtr<nsSupportsWeakReference> tmp2 = do_QueryObject(tmp); which appears in PeerConnectionImpl.cpp is an abuse of do_QueryObject, since nsSupportsWeakReference does not have an IID, so what happens is that tmp gets reinterpreted as an nsSupportsWeakReference*. :bz suggested that the quick fix is to use static_cast<PeerConnectionObserver>(tmp.get()) instead. An alternative would be to change the code generation to add an IID to PeerConnectionObserver so that you could write nsRefPtr<PeerConnectionObserver> pco = do_QueryReferent(mPCObserver); directly and avoid the kludge that is do_QueryObjectReferent. Had it been possible to use an XPIDL interface in the first place then nsCOMPtr<nsIPeerConnectionObserver> pco = do_QueryReferent(mPCObserver); would also have sufficed.
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.