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
54946f46
Commit
54946f46
authored
Oct 02, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed memory leak caused by ViewUpdate() with VIEW_ITEM::GEOMETRY/LAYER parameters.
parent
ff3c2bb6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
view.cpp
common/view/view.cpp
+7
-5
view.h
include/view/view.h
+1
-1
move_tool.cpp
pcbnew/tools/move_tool.cpp
+1
-1
No files found.
common/view/view.cpp
View file @
54946f46
...
@@ -676,9 +676,9 @@ struct VIEW::unlinkItem
...
@@ -676,9 +676,9 @@ struct VIEW::unlinkItem
};
};
struct
VIEW
::
recache
Layer
struct
VIEW
::
recache
Item
{
{
recache
Layer
(
VIEW
*
aView
,
GAL
*
aGal
,
int
aLayer
,
bool
aImmediately
)
:
recache
Item
(
VIEW
*
aView
,
GAL
*
aGal
,
int
aLayer
,
bool
aImmediately
)
:
view
(
aView
),
gal
(
aGal
),
layer
(
aLayer
),
immediately
(
aImmediately
)
view
(
aView
),
gal
(
aGal
),
layer
(
aLayer
),
immediately
(
aImmediately
)
{
{
}
}
...
@@ -688,9 +688,7 @@ struct VIEW::recacheLayer
...
@@ -688,9 +688,7 @@ struct VIEW::recacheLayer
// Remove previously cached group
// Remove previously cached group
int
prevGroup
=
aItem
->
getGroup
(
layer
);
int
prevGroup
=
aItem
->
getGroup
(
layer
);
if
(
prevGroup
>=
0
)
if
(
prevGroup
>=
0
)
{
gal
->
DeleteGroup
(
prevGroup
);
gal
->
DeleteGroup
(
prevGroup
);
}
if
(
immediately
)
if
(
immediately
)
{
{
...
@@ -882,6 +880,10 @@ void VIEW::updateItemGeometry( VIEW_ITEM* aItem, int aLayer )
...
@@ -882,6 +880,10 @@ void VIEW::updateItemGeometry( VIEW_ITEM* aItem, int aLayer )
m_gal
->
SetLayerDepth
(
l
.
renderingOrder
);
m_gal
->
SetLayerDepth
(
l
.
renderingOrder
);
// Redraw the item from scratch
// Redraw the item from scratch
int
prevGroup
=
aItem
->
getGroup
(
aLayer
);
if
(
prevGroup
>=
0
)
m_gal
->
DeleteGroup
(
prevGroup
);
int
group
=
m_gal
->
BeginGroup
();
int
group
=
m_gal
->
BeginGroup
();
aItem
->
setGroup
(
aLayer
,
group
);
aItem
->
setGroup
(
aLayer
,
group
);
m_painter
->
Draw
(
static_cast
<
EDA_ITEM
*>
(
aItem
),
aLayer
);
m_painter
->
Draw
(
static_cast
<
EDA_ITEM
*>
(
aItem
),
aLayer
);
...
@@ -966,7 +968,7 @@ void VIEW::RecacheAllItems( bool aImmediately )
...
@@ -966,7 +968,7 @@ void VIEW::RecacheAllItems( bool aImmediately )
{
{
m_gal
->
SetTarget
(
l
->
target
);
m_gal
->
SetTarget
(
l
->
target
);
m_gal
->
SetLayerDepth
(
l
->
renderingOrder
);
m_gal
->
SetLayerDepth
(
l
->
renderingOrder
);
recache
Layer
visitor
(
this
,
m_gal
,
l
->
id
,
aImmediately
);
recache
Item
visitor
(
this
,
m_gal
,
l
->
id
,
aImmediately
);
l
->
items
->
Query
(
r
,
visitor
);
l
->
items
->
Query
(
r
,
visitor
);
MarkTargetDirty
(
l
->
target
);
MarkTargetDirty
(
l
->
target
);
}
}
...
...
include/view/view.h
View file @
54946f46
...
@@ -500,7 +500,7 @@ private:
...
@@ -500,7 +500,7 @@ private:
// Function objects that need to access VIEW/VIEW_ITEM private/protected members
// Function objects that need to access VIEW/VIEW_ITEM private/protected members
struct
clearLayerCache
;
struct
clearLayerCache
;
struct
recache
Layer
;
struct
recache
Item
;
struct
drawItem
;
struct
drawItem
;
struct
unlinkItem
;
struct
unlinkItem
;
struct
updateItemsColor
;
struct
updateItemsColor
;
...
...
pcbnew/tools/move_tool.cpp
View file @
54946f46
...
@@ -78,7 +78,7 @@ bool MOVE_TOOL::Init()
...
@@ -78,7 +78,7 @@ bool MOVE_TOOL::Init()
int
MOVE_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
int
MOVE_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION_TOOL
::
SELECTION
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION_TOOL
::
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
if
(
selection
.
Empty
()
)
if
(
selection
.
Empty
()
)
return
0
;
// there are no items to operate on
return
0
;
// there are no items to operate on
...
...
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