Closed Bug 554253 Opened 10 years ago Closed 10 years ago

Convert nsCOMPtr<nsPresContext> to nsRefPtr<nsPresContext>

Categories

(Core :: Layout, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla1.9.3a4

People

(Reporter: craig.topper, Assigned: craig.topper)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

nsPresContext is not an interface and should not be using nsCOMPtr. This would cause build failures if nsPresContext gained any more interfaces or lost the one it has.
I temporarily made nsPresContext ambiguously inherit nsISupports and fixed all the build errors to find these. So hopefully that means I got them all.

This is the only questionable part I encountered. Hopefully I did this right.

-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPresContext)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mPresContext.get(), nsPresContext)
Attachment #434184 - Flags: review?(roc)
Comment on attachment 434184 [details] [diff] [review]
Patch to fix all the places I could find

thanks!!!
Attachment #434184 - Flags: review?(roc) → review+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/c16ec7f0a10c
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Summary: Convert nsCOMPtr<nsPresContext> to nsRefPtr<nsPResContext> → Convert nsCOMPtr<nsPresContext> to nsRefPtr<nsPresContext>
Target Milestone: --- → mozilla1.9.3a4
(In reply to comment #1)
> -  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPresContext)
> +  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mPresContext.get(),
> nsPresContext)

This is very wrong, did you even need to change this at all?
I had temporarily made nsISupports and ambiguous base of nsPresContext so I could make sure I caught all places that were using nsCOMPtr. This piece of code failed because inside the macro NoteXPCOMChild is called which takes an nsISupports. Should we change it back or is there a right way to make it support nsRefPtr?
You need to log in before you can comment on or make changes to this bug.