Closed Bug 1153267 Opened 5 years ago Closed 5 years ago

don't NS_ADDREF outparams when we can use smart pointers instead

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(2 files)

No description provided.
If we're already holding something in a smart pointer, there's no need to
NS_ADDREF it on the way out, we can just .forget() into the outparam.
Attachment #8590878 - Flags: review?(ehsan)
This cleans up several easy-to-handle usages of NS_ADDREF'ing raw pointers into
outparams by using smart pointers instead.
Attachment #8590879 - Flags: review?(ehsan)
Comment on attachment 8590878 [details] [diff] [review]
part 1 - use smart-pointer .forget() instead of NS_ADDREF+assign

Review of attachment 8590878 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/streamconv/nsStreamConverterService.cpp
@@ +550,2 @@
>          rv = listener->AsyncConvertData(aFromType, aToType, aListener, aContext);
> +        listener.forget(_retval);

Hmm, this changes the semantics of the code slightly, but hopefully that's ok...
Attachment #8590878 - Flags: review?(ehsan) → review+
Attachment #8590879 - Flags: review?(ehsan) → review+
You need to log in before you can comment on or make changes to this bug.