Closed Bug 1240484 Opened 4 years ago Closed 4 years ago

[Static Analysis][Nesting level does not match indentation] In function ShutdownXPCOM from XPCOMInit.cpp

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox45 --- unaffected
firefox46 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1348593 )

Attachments

(1 file)

The Static Analysis tool Coverity added that there could be a control flow issue, on the following code:

>>    if (observerService)
>>      mozilla::KillClearOnShutdown(ShutdownPhase::ShutdownThreads);
>>      observerService->NotifyObservers(nullptr,
>>                                       NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
>>                                       nullptr);

As it can be seen from the above code, i think there should be brackets and the actual if branch should look like this, specially that observerService is null checked and dereferenced later on:

>>    if (observerService)
>>    {
>>      mozilla::KillClearOnShutdown(ShutdownPhase::ShutdownThreads);
>>      observerService->NotifyObservers(nullptr,
>>          NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
>>          nullptr);
>>    }
Attachment #8708971 - Flags: review?(continuation)
Comment on attachment 8708971 [details]
MozReview Request: Bug 1240484 - fixed control flow patch issue by adding brackets. r?mccr8

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31203/diff/1-2/
Attachment #8708971 - Attachment description: MozReview Request: Bug 1240484 - fixed control flow patch issue by adding brackets. r?continuation@gmail.com → MozReview Request: Bug 1240484 - fixed control flow patch issue by adding brackets. r?mccr8
Nice. It looks like the dropped check only because an issue in bug 1237794.

I don't understand why the brace for this if block wasn't added in bug 1046841, but oh well.
Blocks: 1237794
(In reply to Andrew McCreight [:mccr8] from comment #3)
> Nice. It looks like the dropped check only because an issue in bug 1237794.

I meant, "only became an issue in bug 1237794".
Comment on attachment 8708971 [details]
MozReview Request: Bug 1240484 - fixed control flow patch issue by adding brackets. r?mccr8

https://reviewboard.mozilla.org/r/31203/#review27993
Attachment #8708971 - Flags: review?(continuation) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/5df98a0e4cdd
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.