Closed Bug 884019 Opened 7 years ago Closed 7 years ago

rv is sometimes used uninitialized warning in nsNodeUtils

Categories

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

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: mccr8, Assigned: mccr8)

Details

Attachments

(1 file)

This is in nsNodeUtils::CloneAndAdopt:

nsIXPConnect *xpc = nsContentUtils::XPConnect();
if (xpc) {
  rv = xpc->ReparentWrappedNativeIfFound(cx, wrapper, aReparentScope, aNode);
}

If we hit the else branch, then rv isn't initialized when we return.  Of course, XPConnect() is fallible now, I think, so we should just eliminate the branch to eliminate the error message.
> Of course, XPConnect() is fallible now,
That should be infallible, of course...
My local clang build was complaining about this.
There's at least one place in the code where we do null-check XPConnect() so I'm nervous about changing the behavior, so I'll just leave it as is, and fail if there's no XPConnect.  Peter changed this code most recently, so I'll ask him for review.
Assignee: nobody → continuation
Attachment #764284 - Flags: review?(peterv)
Attachment #764284 - Flags: review?(peterv) → review+
https://hg.mozilla.org/mozilla-central/rev/46cfc6fc7364
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.