Closed Bug 1361499 Opened 3 years ago Closed 3 years ago

coverity report: Non-static class member "mState" is not initialized in this constructor nor in any functions that it calls.

Categories

(Core :: Layout, defect, trivial)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: mats, Assigned: mats)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, Whiteboard: [CID 1405754])

Attachments

(1 file)

** CID 1405754:  Uninitialized members  (UNINIT_CTOR)
/layout/generic/nsIFrame.h: 615 in nsIFrame::nsIFrame(mozilla::FrameType)()


________________________________________________________________________________________________________
*** CID 1405754:  Uninitialized members  (UNINIT_CTOR)
/layout/generic/nsIFrame.h: 615 in nsIFrame::nsIFrame(mozilla::FrameType)()
609         , mParent(nullptr)
610         , mNextSibling(nullptr)
611         , mPrevSibling(nullptr)
612         , mType(aType)
613       {
614         mozilla::PodZero(&mOverflow);
>>>     CID 1405754:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "mState" is not initialized in this constructor nor in any functions that it calls.
615       }
616     
617       nsPresContext* PresContext() const {
618         return StyleContext()->PresContext();
619       }
620
Attached patch fixSplinter Review
I think this is a false positive since the nsFrame ctor initialize it and
all frames we create derives from nsFrame:
http://searchfox.org/mozilla-central/rev/ae8c2e2354db652950fe0ec16983360c21857f2a/layout/generic/nsFrame.cpp#460

But we might as well initialize it properly, now that the pres shell arena
doesn't zero our memory anymore.
Attachment #8863894 - Flags: review?(jfkthame)
Attachment #8863894 - Flags: review?(jfkthame) → review+
Pushed by mpalmgren@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/53042524877a
Initialize nsIFrame::mState in the ctor to avoid Coverity warnings.  r=jfkthame
Flags: in-testsuite-
https://hg.mozilla.org/mozilla-central/rev/53042524877a
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Whiteboard: [CID 1405754]
You need to log in before you can comment on or make changes to this bug.