Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Pitiot
CGoGN
Commits
cbaa11ce
Commit
cbaa11ce
authored
Aug 14, 2012
by
Sylvain Thery
Browse files
correctly delete registry at map destruction (thanks to valgrind)
parent
c4277eaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/Topology/generic/genericmap.h
View file @
cbaa11ce
...
...
@@ -83,6 +83,8 @@ protected:
static
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>*
m_attributes_registry_map
;
static
int
m_nbInstances
;
/**
* Direct access to the Dart attributes that store the orbits embeddings
* (only initialized when necessary)
...
...
src/Topology/generic/genericmap.cpp
View file @
cbaa11ce
...
...
@@ -34,12 +34,15 @@ namespace CGoGN
{
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>*
GenericMap
::
m_attributes_registry_map
=
NULL
;
int
GenericMap
::
m_nbInstances
=
0
;
GenericMap
::
GenericMap
()
:
m_nbThreads
(
1
)
{
if
(
m_attributes_registry_map
==
NULL
)
m_attributes_registry_map
=
new
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>
;
m_nbInstances
++
;
// register all known types
registerAttribute
<
Dart
>
(
"Dart"
);
registerAttribute
<
Mark
>
(
"Mark"
);
...
...
@@ -115,8 +118,19 @@ GenericMap::~GenericMap()
(
*
it
)
->
setReleaseOnDestruct
(
false
)
;
cellMarkers
.
clear
()
;
if
(
m_attributes_registry_map
)
// if(m_attributes_registry_map)
// {
// delete m_attributes_registry_map;
// m_attributes_registry_map = NULL;
// }
// clean type registry if necessary
m_nbInstances
--
;
if
(
m_nbInstances
<=
0
)
{
for
(
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>::
iterator
it
=
m_attributes_registry_map
->
begin
();
it
!=
m_attributes_registry_map
->
end
();
++
it
)
delete
it
->
second
;
delete
m_attributes_registry_map
;
m_attributes_registry_map
=
NULL
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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