Flush model data upon exit of Footprint Properties dialogs

This commit is contained in:
Cirilo Bernardo 2016-02-21 11:54:34 +11:00
parent 25a5db9092
commit 5776037a70
4 changed files with 15 additions and 4 deletions

View File

@ -651,7 +651,7 @@ std::list< wxString > const* S3D_CACHE::GetFileFilters( void ) const
}
void S3D_CACHE::FlushCache( void )
void S3D_CACHE::FlushCache( bool closePlugins )
{
std::list< S3D_CACHE_ENTRY* >::iterator sCL = m_CacheList.begin();
std::list< S3D_CACHE_ENTRY* >::iterator eCL = m_CacheList.end();
@ -663,7 +663,10 @@ void S3D_CACHE::FlushCache( void )
}
m_CacheList.clear();
ClosePlugins();
m_CacheMap.clear();
if( closePlugins )
ClosePlugins();
return;
}

View File

@ -172,9 +172,9 @@ public:
/**
* Function FlushCache
* frees all data in the cache and closes all plugins
* frees all data in the cache and by default closes all plugins
*/
void FlushCache( void );
void FlushCache( bool closePlugins = true );
/**
* Function ClosePlugins

View File

@ -95,6 +95,10 @@ DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR()
m_Shapes3D_list.clear();
// free the memory used by all models, otherwise models which were
// browsed but not used would consume memory
Prj().Get3DCacheManager()->FlushCache( false );
delete m_ReferenceCopy;
delete m_ValueCopy;
}

View File

@ -94,6 +94,10 @@ DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR()
m_shapes3D_list.clear();
// free the memory used by all models, otherwise models which were
// browsed but not used would consume memory
Prj().Get3DCacheManager()->FlushCache( false );
delete m_referenceCopy;
delete m_valueCopy;
}