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
c87baa9d
Commit
c87baa9d
authored
May 23, 2014
by
Tomasz Wlostowski
Committed by
Maciej Suminski
May 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
router: fix segfault when trying to shove a line that forms a closed loop.
parent
0db76ecb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
pns_node.cpp
pcbnew/router/pns_node.cpp
+23
-11
pns_node.h
pcbnew/router/pns_node.h
+2
-1
No files found.
pcbnew/router/pns_node.cpp
View file @
c87baa9d
...
...
@@ -715,25 +715,34 @@ void PNS_NODE::Remove( PNS_ITEM* aItem )
void
PNS_NODE
::
followLine
(
PNS_SEGMENT
*
aCurrent
,
bool
aScanDirection
,
int
&
aPos
,
int
aLimit
,
VECTOR2I
*
aCorners
,
PNS_SEGMENT
**
aSegments
)
int
aLimit
,
VECTOR2I
*
aCorners
,
PNS_SEGMENT
**
aSegments
,
bool
&
aGuardHit
)
{
bool
prevReversed
=
false
;
for
(
;
;
)
const
VECTOR2I
guard
=
aScanDirection
?
aCurrent
->
Seg
().
B
:
aCurrent
->
Seg
().
A
;
for
(
int
count
=
0
;
;
++
count
)
{
const
VECTOR2I
p
=
(
aScanDirection
^
prevReversed
)
?
aCurrent
->
Seg
().
B
:
aCurrent
->
Seg
().
A
;
const
PNS_JOINT
*
jt
=
FindJoint
(
p
,
aCurrent
);
assert
(
jt
);
assert
(
aPos
>
0
&&
aPos
<
aLimit
);
aCorners
[
aPos
]
=
jt
->
Pos
();
aSegments
[
aPos
]
=
aCurrent
;
if
(
count
&&
guard
==
p
)
{
aSegments
[
aPos
]
=
NULL
;
aGuardHit
=
true
;
break
;
}
aSegments
[
aPos
]
=
aCurrent
;
aPos
+=
(
aScanDirection
?
1
:
-
1
);
if
(
!
jt
->
IsLineCorner
()
)
if
(
!
jt
->
IsLineCorner
()
||
aPos
<
0
||
aPos
==
aLimit
)
break
;
aCurrent
=
jt
->
NextSegment
(
aCurrent
);
...
...
@@ -752,6 +761,8 @@ PNS_LINE* PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex)
PNS_SEGMENT
*
segs
[
MaxVerts
+
1
];
PNS_LINE
*
pl
=
new
PNS_LINE
;
bool
guardHit
=
false
;
int
i_start
=
MaxVerts
/
2
,
i_end
=
i_start
+
1
;
pl
->
SetWidth
(
aSeg
->
Width
()
);
...
...
@@ -759,9 +770,11 @@ PNS_LINE* PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex)
pl
->
SetNet
(
aSeg
->
Net
()
);
pl
->
SetOwner
(
this
);
followLine
(
aSeg
,
false
,
i_start
,
MaxVerts
,
corners
,
segs
);
followLine
(
aSeg
,
true
,
i_end
,
MaxVerts
,
corners
,
segs
);
followLine
(
aSeg
,
false
,
i_start
,
MaxVerts
,
corners
,
segs
,
guardHit
);
if
(
!
guardHit
)
followLine
(
aSeg
,
true
,
i_end
,
MaxVerts
,
corners
,
segs
,
guardHit
);
int
n
=
0
;
PNS_SEGMENT
*
prev_seg
=
NULL
;
...
...
@@ -772,7 +785,7 @@ PNS_LINE* PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex)
pl
->
Line
().
Append
(
p
);
if
(
prev_seg
!=
segs
[
i
]
)
if
(
segs
[
i
]
&&
prev_seg
!=
segs
[
i
]
)
{
pl
->
LinkSegment
(
segs
[
i
]
);
...
...
@@ -785,10 +798,9 @@ PNS_LINE* PNS_NODE::AssembleLine( PNS_SEGMENT* aSeg, int* aOriginSegmentIndex)
prev_seg
=
segs
[
i
];
}
assert
(
pl
->
SegmentCount
()
!=
0
);
assert
(
pl
->
SegmentCount
()
==
(
int
)
pl
->
LinkedSegments
()
->
size
()
);
return
pl
;
}
...
...
pcbnew/router/pns_node.h
View file @
c87baa9d
...
...
@@ -380,7 +380,8 @@ private:
int
&
aPos
,
int
aLimit
,
VECTOR2I
*
aCorners
,
PNS_SEGMENT
**
aSegments
);
PNS_SEGMENT
**
aSegments
,
bool
&
aGuardHit
);
///> hash table with the joints, linking the items. Joints are hashed by
///> their position, layer set and net.
...
...
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