Skip to content
Snippets Groups Projects
Commit 88881f01 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix memory leak from cast api

parent dce96d49
No related branches found
No related tags found
No related merge requests found
......@@ -54,9 +54,18 @@ struct castApi {
};
 
private:
class CastPoolBaseMap : public std::map < std::type_index, CastPoolBase * > {
public:
~CastPoolBaseMap ( ) {
for ( const std::pair < std::type_index, CastPoolBase * > & item : * this )
delete item.second;
}
};
// INFO: Function exist to handle static order of initialisation
static std::map < std::type_index, CastPoolBase * > & castFunctionsById ( ) {
static std::map < std::type_index, CastPoolBase * > res;
static CastPoolBaseMap res;
 
return res;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment