Closed Bug 1361659 Opened 7 years ago Closed 7 years ago

Coverity report: mozilla::​BRFrame::​BRFrame(nsStyleContext *): A scalar field is not initialized by the constructor

Categories

(Core :: Layout, defect, P4)

53 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox-esr52 --- unaffected
firefox53 --- wontfix
firefox54 --- wontfix
firefox55 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: emilio)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, good-first-bug, regression, Whiteboard: [lang=C++][CID 1396665])

Coverity CID 1396665 Uninitialized scalar field

The field will contain an arbitrary value left over from earlier computations.

In mozilla::​BRFrame::​BRFrame(nsStyleContext *): A scalar field is not initialized by the constructor


 65protected:
 66  explicit BRFrame(nsStyleContext* aContext)
 67    : nsFrame(aContext, LayoutFrameType::Br)
   CID 1396665 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)2. uninit_member: Non-static class member mAscent is not initialized in this constructor nor in any functions that it calls.
 68  {}
This is sort of a false positive since we only use mAscent in GetLogicalBaseline()
and mAscent is always set in Reflow(), and Reflow() must be called before
GetLogicalBaseline().

We should probably init mAscent in the ctor to NS_INTRINSIC_WIDTH_UNKNOWN anyway
to catch any errors.  (Maybe also rename it to mBaseline to follow the naming
convention used in other classes.)
https://hg.mozilla.org/mozilla-central/rev/952e377dbace
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Assignee: nobody → emilio+bugs
Whiteboard: [lang=C++] → [lang=C++][CID 1396665]
You need to log in before you can comment on or make changes to this bug.