Closed Bug 565620 Opened 10 years ago Closed 10 years ago

the NativeJSContext constructor needs to initialize more variables or the class needs to be much more careful

Categories

(Core :: Canvas: 2D, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity)

Attachments

(1 file)

17 class NativeJSContext {
18 public:
19     NativeJSContext() {
20         error = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
21         if (NS_FAILED(error))
22             return;
23 
24         if (!ncc) {
25             error = NS_ERROR_FAILURE;
26             return;
27         }

this is not always reached:
29         ctx = nsnull;

this code is always reached:
41     ~NativeJSContext() {
and this might be uninitialized:
42         JS_EndRequest(ctx);
Attached patch proposalSplinter Review
the assertions are optional, all that's necessary is the change to the destructor
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #445090 - Flags: review?(vladimir)
Comment on attachment 445090 [details] [diff] [review]
proposal

Looks good, thanks!  Slowly working through removing all NativeJSContext usage, but it'll be a while... so good to have this in.
Attachment #445090 - Flags: review?(vladimir) → review+
http://hg.mozilla.org/mozilla-central/rev/17f4cddda257
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.