Skip to content

Commit

Permalink
TD: [skip ci] Fix coverity warning
Browse files Browse the repository at this point in the history
Coverity warnings fixed:

CID 316559 (#1 of 1): Uninitialized scalar variable (UNINIT)
3. uninit_use_in_call: Using uninitialized value we. Field we.idx is uninitialized when calling push_back

CID 316549 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
4. uninit_member: Non-static class member pageheight is not initialized in this constructor nor in any functions that it calls.

CID 186161 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
2. uninit_member: Non-static class member parent is not initialized in this constructor nor in any functions that it calls.

CID 305170 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking this->m_baseFeat suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

CID 186152 (#2 of 2): Uninitialized pointer field (UNINIT_CTOR)
3. uninit_member: Non-static class member m_mdi is not initialized in this constructor nor in any functions that it calls.

CID 192588 (#1 of 1): Same on both sides (CONSTANT_EXPRESSION_RESULT)
pointless_expression
  • Loading branch information
wwmayer committed Feb 21, 2021
1 parent 1d41226 commit e728c35
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Mod/TechDraw/App/EdgeWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ std::vector<WalkerEdge> EdgeWalker::makeWalkerEdges(std::vector<TopoDS_Edge> edg
WalkerEdge we;
we.v1 = v1dx;
we.v2 = v2dx;
we.idx = 0;
walkerEdges.push_back(we);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Mod/TechDraw/Gui/MDIViewPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ MDIViewPage::MDIViewPage(ViewProviderPage *pageVp, Gui::Document* doc, QWidget*
m_orientation(QPrinter::Landscape),
m_paperSize(QPrinter::A4),
#endif
pagewidth(0.0),
pageheight(0.0),
m_vpPage(pageVp)
{

Expand Down
2 changes: 2 additions & 0 deletions src/Mod/TechDraw/Gui/QGIViewDimension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ QGIDatumLabel::QGIDatumLabel()
posX = 0;
posY = 0;

parent = nullptr;

setCacheMode(QGraphicsItem::NoCache);
setFlag(ItemSendsGeometryChanges, true);
setFlag(ItemIsMovable, true);
Expand Down
6 changes: 4 additions & 2 deletions src/Mod/TechDraw/Gui/TaskLeaderLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ void TaskLeaderLine::createLeaderFeature(std::vector<Base::Vector3d> converted)
m_leaderType.c_str(),m_leaderName.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",
PageName.c_str(),m_leaderName.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.LeaderParent = App.activeDocument().%s",
m_leaderName.c_str(),m_baseFeat->getNameInDocument());
if (m_baseFeat != nullptr) {
Command::doCommand(Command::Doc,"App.activeDocument().%s.LeaderParent = App.activeDocument().%s",
m_leaderName.c_str(),m_baseFeat->getNameInDocument());
}

App::DocumentObject* obj = m_basePage->getDocument()->getObject(m_leaderName.c_str());
if (obj == nullptr) {
Expand Down
1 change: 1 addition & 0 deletions src/Mod/TechDraw/Gui/TaskRichAnno.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ using namespace TechDrawGui;
TaskRichAnno::TaskRichAnno(TechDrawGui::ViewProviderRichAnno* annoVP) :
ui(new Ui_TaskRichAnno),
blockUpdate(false),
m_mdi(nullptr),
m_view(nullptr),
m_annoVP(annoVP),
m_baseFeat(nullptr),
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/TDTest/DVBalloonTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def DVBalloonTest():
FreeCAD.ActiveDocument.recompute()

rc = False
if ("Up-to-date" in balloon2.State) and ("Up-to-date" in balloon2.State):
if ("Up-to-date" in balloon1.State) and ("Up-to-date" in balloon2.State):
rc = True
FreeCAD.closeDocument("TDBalloon")
return rc
Expand Down

0 comments on commit e728c35

Please sign in to comment.