Prevent schematic I/O plugin from setting the library cache to null.
Don't call init() when performing library functions as it was always setting the m_cache variable to null which cause the library to be reloaded every time a library command was performed as well as a memory leak. Delete cache object when the plugin is destroyed.
This commit is contained in:
parent
73bbc35c3e
commit
fda677eecc
|
@ -470,6 +470,12 @@ SCH_LEGACY_PLUGIN::SCH_LEGACY_PLUGIN()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SCH_LEGACY_PLUGIN::~SCH_LEGACY_PLUGIN()
|
||||||
|
{
|
||||||
|
delete m_cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN::init( KIWAY* aKiway, const PROPERTIES* aProperties )
|
void SCH_LEGACY_PLUGIN::init( KIWAY* aKiway, const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
m_version = 0;
|
m_version = 0;
|
||||||
|
@ -3381,7 +3387,7 @@ size_t SCH_LEGACY_PLUGIN::GetSymbolLibCount( const wxString& aLibraryPath,
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
init( NULL, aProperties );
|
m_props = aProperties;
|
||||||
|
|
||||||
cacheLib( aLibraryPath );
|
cacheLib( aLibraryPath );
|
||||||
|
|
||||||
|
@ -3395,7 +3401,7 @@ void SCH_LEGACY_PLUGIN::EnumerateSymbolLib( wxArrayString& aAliasNameList,
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
init( NULL, aProperties );
|
m_props = aProperties;
|
||||||
|
|
||||||
cacheLib( aLibraryPath );
|
cacheLib( aLibraryPath );
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class SCH_LEGACY_PLUGIN : public SCH_PLUGIN
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SCH_LEGACY_PLUGIN();
|
SCH_LEGACY_PLUGIN();
|
||||||
virtual ~SCH_LEGACY_PLUGIN() {}
|
virtual ~SCH_LEGACY_PLUGIN();
|
||||||
|
|
||||||
const wxString GetName() const override
|
const wxString GetName() const override
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue