Closed Bug 1430297 Opened 6 years ago Closed 6 years ago

Make NS_ADDREF & "Release()" calls consistent in nsCSSFrameConstructor.cpp

Categories

(Core :: Layout, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(1 file)

In Bug 1400618, we added this line:
>     item.mContent->Release();

...which is paired up with this earlier older line:
>     NS_ADDREF(item->mContent);


We should make these consistent (either both use the macro, or both *not* use the macro), to avoid confusion[1].  Based on my instincts & on bug 804206, I think it's better to move away from the macro -- so let's replace NS_ADDREF with an AddRef() call.

[1] In particular -- this confused me today because I ran across the NS_ADDREF and then was surprised that I wasn't able to find a matching NS_RELEASE(...) call.
Links for the code-quotes in comment 0: the NS_ADDREF is here:
 https://hg.mozilla.org/mozilla-central/rev/9a72b179c10d#l2.11
...and the Release() is here:
 https://hg.mozilla.org/mozilla-central/rev/9a72b179c10d#l2.75
Comment on attachment 8942365 [details]
Bug 1430297: Use AddRef() instead of NS_ADDREF (when keeping generated content alive in nsCSSFrameConstructor).

https://reviewboard.mozilla.org/r/212652/#review218356
Attachment #8942365 - Flags: review?(mats) → review+
Thanks for the review!

Upon reflection, I realized that my first commit message was ambiguous (my wording "...to keep generated content alive..." sounded a bit like *this changeset* was making us start to keep stuff alive).

I changed to instead say "(when keeping...)" which I think is a bit of a clearer modifier.
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c5094851201b
Use AddRef() instead of NS_ADDREF (when keeping generated content alive in nsCSSFrameConstructor). r=mats
https://hg.mozilla.org/mozilla-central/rev/c5094851201b
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: