Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
721949b5
Commit
721949b5
authored
Mar 10, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak in pns_node and pns_line_placer. Fix coverity uninitialized warnings.
parent
97e4a389
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
15 deletions
+66
-15
pns_diff_pair.cpp
pcbnew/router/pns_diff_pair.cpp
+3
-1
pns_diff_pair_placer.cpp
pcbnew/router/pns_diff_pair_placer.cpp
+18
-0
pns_dragger.cpp
pcbnew/router/pns_dragger.cpp
+8
-0
pns_line_placer.cpp
pcbnew/router/pns_line_placer.cpp
+12
-7
pns_node.cpp
pcbnew/router/pns_node.cpp
+9
-2
pns_optimizer.cpp
pcbnew/router/pns_optimizer.cpp
+6
-5
pns_tool_base.cpp
pcbnew/router/pns_tool_base.cpp
+10
-0
No files found.
pcbnew/router/pns_diff_pair.cpp
View file @
721949b5
...
@@ -385,7 +385,6 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
...
@@ -385,7 +385,6 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
p0_n
=
aPair
.
AnchorN
();
p0_n
=
aPair
.
AnchorN
();
shP
=
aPair
.
PrimP
()
->
Shape
();
shP
=
aPair
.
PrimP
()
->
Shape
();
}
}
else
if
(
aPair
.
PrimP
()
->
OfKind
(
PNS_ITEM
::
SEGMENT
)
&&
aPair
.
PrimN
()
->
OfKind
(
PNS_ITEM
::
SEGMENT
)
)
else
if
(
aPair
.
PrimP
()
->
OfKind
(
PNS_ITEM
::
SEGMENT
)
&&
aPair
.
PrimN
()
->
OfKind
(
PNS_ITEM
::
SEGMENT
)
)
{
{
...
@@ -396,6 +395,9 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
...
@@ -396,6 +395,9 @@ void PNS_DP_GATEWAYS::BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool
majorDirection
=
(
p0_p
-
p0_n
).
Perpendicular
();
majorDirection
=
(
p0_p
-
p0_n
).
Perpendicular
();
if
(
shP
==
NULL
)
return
;
switch
(
shP
->
Type
()
)
switch
(
shP
->
Type
()
)
{
{
case
SH_RECT
:
case
SH_RECT
:
...
...
pcbnew/router/pns_diff_pair_placer.cpp
View file @
721949b5
...
@@ -42,11 +42,29 @@ using boost::optional;
...
@@ -42,11 +42,29 @@ using boost::optional;
PNS_DIFF_PAIR_PLACER
::
PNS_DIFF_PAIR_PLACER
(
PNS_ROUTER
*
aRouter
)
:
PNS_DIFF_PAIR_PLACER
::
PNS_DIFF_PAIR_PLACER
(
PNS_ROUTER
*
aRouter
)
:
PNS_PLACEMENT_ALGO
(
aRouter
)
PNS_PLACEMENT_ALGO
(
aRouter
)
{
{
m_state
=
RT_START
;
m_chainedPlacement
=
false
;
m_initialDiagonal
=
false
;
m_initialDiagonal
=
false
;
m_startDiagonal
=
false
;
m_startDiagonal
=
false
;
m_fitOk
=
false
;
m_netP
=
0
;
m_netN
=
0
;
m_iteration
=
0
;
m_world
=
NULL
;
m_world
=
NULL
;
m_shove
=
NULL
;
m_shove
=
NULL
;
m_currentNode
=
NULL
;
m_currentNode
=
NULL
;
m_lastNode
=
NULL
;
m_placingVia
=
false
;
m_viaDiameter
=
0
;
m_viaDrill
=
0
;
m_currentWidth
=
0
;
m_currentNet
=
0
;
m_currentLayer
=
0
;
m_startsOnVia
=
false
;
m_orthoMode
=
false
;
m_snapOnTarget
=
false
;
m_currentEndItem
=
NULL
;
m_currentMode
=
RM_MarkObstacles
;
m_idle
=
true
;
m_idle
=
true
;
}
}
...
...
pcbnew/router/pns_dragger.cpp
View file @
721949b5
...
@@ -28,7 +28,15 @@ PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
...
@@ -28,7 +28,15 @@ PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
PNS_ALGO_BASE
(
aRouter
)
PNS_ALGO_BASE
(
aRouter
)
{
{
m_world
=
NULL
;
m_world
=
NULL
;
m_lastNode
=
NULL
;
m_mode
=
SEGMENT
;
m_draggedLine
=
NULL
;
m_draggedVia
=
NULL
;
m_shove
=
NULL
;
m_shove
=
NULL
;
m_draggedSegmentIndex
=
0
;
m_dragStatus
=
false
;
m_currentMode
=
RM_MarkObstacles
;
m_initialVia
=
NULL
;
}
}
...
...
pcbnew/router/pns_line_placer.cpp
View file @
721949b5
...
@@ -929,7 +929,9 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
...
@@ -929,7 +929,9 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
m_chainedPlacement
=
!
pl
.
EndsWithVia
();
m_chainedPlacement
=
!
pl
.
EndsWithVia
();
m_splitSeg
=
false
;
m_splitSeg
=
false
;
initPlacement
(
);
initPlacement
(
);
}
else
{
}
else
{
m_idle
=
true
;
m_idle
=
true
;
}
}
...
@@ -955,7 +957,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
...
@@ -955,7 +957,7 @@ void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
if
(
a
==
b
)
if
(
a
==
b
)
{
{
aNode
->
FindLineEnds
(
aLatest
,
a
,
b
);
aNode
->
FindLineEnds
(
aLatest
,
a
,
b
);
}
}
aNode
->
FindLinesBetweenJoints
(
a
,
b
,
lines
);
aNode
->
FindLinesBetweenJoints
(
a
,
b
,
lines
);
...
@@ -992,20 +994,23 @@ void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest )
...
@@ -992,20 +994,23 @@ void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest )
if
(
simplified
.
PointCount
()
!=
l
->
PointCount
()
)
if
(
simplified
.
PointCount
()
!=
l
->
PointCount
()
)
{
{
std
::
auto_ptr
<
PNS_LINE
>
lnew
(
l
->
Clone
()
);
std
::
auto_ptr
<
PNS_LINE
>
lnew
(
l
->
Clone
()
);
aNode
->
Remove
(
l
);
aNode
->
Remove
(
l
);
lnew
->
SetShape
(
simplified
);
lnew
->
SetShape
(
simplified
);
aNode
->
Add
(
lnew
.
get
()
);
aNode
->
Add
(
lnew
.
get
()
);
}
}
delete
l
;
}
}
void
PNS_LINE_PLACER
::
UpdateSizes
(
const
PNS_SIZES_SETTINGS
&
aSizes
)
void
PNS_LINE_PLACER
::
UpdateSizes
(
const
PNS_SIZES_SETTINGS
&
aSizes
)
{
{
m_sizes
=
aSizes
;
m_sizes
=
aSizes
;
if
(
!
m_idle
)
if
(
!
m_idle
)
{
{
initPlacement
(
m_splitSeg
);
initPlacement
(
m_splitSeg
);
Move
(
m_currentEnd
,
NULL
);
Move
(
m_currentEnd
,
NULL
);
}
}
}
}
...
@@ -1015,7 +1020,7 @@ void PNS_LINE_PLACER::updateLeadingRatLine()
...
@@ -1015,7 +1020,7 @@ void PNS_LINE_PLACER::updateLeadingRatLine()
{
{
PNS_LINE
current
=
Trace
();
PNS_LINE
current
=
Trace
();
SHAPE_LINE_CHAIN
ratLine
;
SHAPE_LINE_CHAIN
ratLine
;
PNS_TOPOLOGY
topo
(
m_lastNode
);
PNS_TOPOLOGY
topo
(
m_lastNode
);
if
(
topo
.
LeadingRatLine
(
&
current
,
ratLine
)
)
if
(
topo
.
LeadingRatLine
(
&
current
,
ratLine
)
)
Router
()
->
DisplayDebugLine
(
ratLine
,
5
,
10000
);
Router
()
->
DisplayDebugLine
(
ratLine
,
5
,
10000
);
...
...
pcbnew/router/pns_node.cpp
View file @
721949b5
...
@@ -52,6 +52,7 @@ PNS_NODE::PNS_NODE()
...
@@ -52,6 +52,7 @@ PNS_NODE::PNS_NODE()
m_root
=
this
;
m_root
=
this
;
m_parent
=
NULL
;
m_parent
=
NULL
;
m_maxClearance
=
800000
;
// fixme: depends on how thick traces are.
m_maxClearance
=
800000
;
// fixme: depends on how thick traces are.
m_clearanceFunctor
=
NULL
;
m_index
=
new
PNS_INDEX
;
m_index
=
new
PNS_INDEX
;
m_collisionFilter
=
NULL
;
m_collisionFilter
=
NULL
;
...
@@ -179,6 +180,8 @@ struct PNS_NODE::OBSTACLE_VISITOR
...
@@ -179,6 +180,8 @@ struct PNS_NODE::OBSTACLE_VISITOR
int
m_extraClearance
;
int
m_extraClearance
;
OBSTACLE_VISITOR
(
PNS_NODE
::
OBSTACLES
&
aTab
,
const
PNS_ITEM
*
aItem
,
int
aKindMask
)
:
OBSTACLE_VISITOR
(
PNS_NODE
::
OBSTACLES
&
aTab
,
const
PNS_ITEM
*
aItem
,
int
aKindMask
)
:
m_node
(
NULL
),
m_override
(
NULL
),
m_tab
(
aTab
),
m_tab
(
aTab
),
m_item
(
aItem
),
m_item
(
aItem
),
m_kindMask
(
aKindMask
),
m_kindMask
(
aKindMask
),
...
@@ -517,11 +520,15 @@ void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant )
...
@@ -517,11 +520,15 @@ void PNS_NODE::addLine( PNS_LINE* aLine, bool aAllowRedundant )
PNS_SEGMENT
*
pseg
=
new
PNS_SEGMENT
(
*
aLine
,
s
);
PNS_SEGMENT
*
pseg
=
new
PNS_SEGMENT
(
*
aLine
,
s
);
PNS_SEGMENT
*
psegR
=
NULL
;
PNS_SEGMENT
*
psegR
=
NULL
;
if
(
!
aAllowRedundant
)
if
(
!
aAllowRedundant
)
psegR
=
findRedundantSegment
(
pseg
);
psegR
=
findRedundantSegment
(
pseg
);
if
(
psegR
)
if
(
psegR
)
{
aLine
->
LinkSegment
(
psegR
);
aLine
->
LinkSegment
(
psegR
);
delete
pseg
;
}
else
else
{
{
pseg
->
SetOwner
(
this
);
pseg
->
SetOwner
(
this
);
...
...
pcbnew/router/pns_optimizer.cpp
View file @
721949b5
...
@@ -119,16 +119,17 @@ bool PNS_COST_ESTIMATOR::IsBetter( PNS_COST_ESTIMATOR& aOther,
...
@@ -119,16 +119,17 @@ bool PNS_COST_ESTIMATOR::IsBetter( PNS_COST_ESTIMATOR& aOther,
* Optimizer
* Optimizer
**/
**/
PNS_OPTIMIZER
::
PNS_OPTIMIZER
(
PNS_NODE
*
aWorld
)
:
PNS_OPTIMIZER
::
PNS_OPTIMIZER
(
PNS_NODE
*
aWorld
)
:
m_world
(
aWorld
),
m_collisionKindMask
(
PNS_ITEM
::
ANY
),
m_effortLevel
(
MERGE_SEGMENTS
)
m_world
(
aWorld
),
m_collisionKindMask
(
PNS_ITEM
::
ANY
),
m_effortLevel
(
MERGE_SEGMENTS
),
m_keepPostures
(
false
),
m_restrictAreaActive
(
false
)
{
{
// m_cache = new SHAPE_INDEX_LIST<PNS_ITEM*>();
m_restrictAreaActive
=
false
;
}
}
PNS_OPTIMIZER
::~
PNS_OPTIMIZER
()
PNS_OPTIMIZER
::~
PNS_OPTIMIZER
()
{
{
// delete m_cache;
}
}
...
@@ -188,7 +189,7 @@ void PNS_OPTIMIZER::removeCachedSegments( PNS_LINE* aLine, int aStartVertex, int
...
@@ -188,7 +189,7 @@ void PNS_OPTIMIZER::removeCachedSegments( PNS_LINE* aLine, int aStartVertex, int
PNS_SEGMENT
*
s
=
(
*
segs
)[
i
];
PNS_SEGMENT
*
s
=
(
*
segs
)[
i
];
m_cacheTags
.
erase
(
s
);
m_cacheTags
.
erase
(
s
);
m_cache
.
Remove
(
s
);
m_cache
.
Remove
(
s
);
}
// *cacheRemove( (*segs)[i] );
}
}
}
...
...
pcbnew/router/pns_tool_base.cpp
View file @
721949b5
...
@@ -64,6 +64,16 @@ PNS_TOOL_BASE::PNS_TOOL_BASE( const std::string& aToolName ) :
...
@@ -64,6 +64,16 @@ PNS_TOOL_BASE::PNS_TOOL_BASE( const std::string& aToolName ) :
TOOL_INTERACTIVE
(
aToolName
)
TOOL_INTERACTIVE
(
aToolName
)
{
{
m_router
=
NULL
;
m_router
=
NULL
;
m_startItem
=
NULL
;
m_startLayer
=
0
;
m_endItem
=
NULL
;
m_needsSync
=
false
;
m_frame
=
NULL
;
m_ctls
=
NULL
;
m_board
=
NULL
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment