LIB_LOGGER: fix a crash when closing Kicad, if Libedit was run.
wxLog::SetActiveTarget() was initialised to libedit frame, but the active target was not released after closing and deleting libedit, thus creating a crash on Kicad exit.
This commit is contained in:
parent
1a7cef2950
commit
9259f3a7c9
|
@ -48,10 +48,22 @@ class SYMBOL_LIB_TABLE_ROW;
|
||||||
class LIB_LOGGER : public wxLogGui
|
class LIB_LOGGER : public wxLogGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
LIB_LOGGER() : m_previousLogger( nullptr ), m_activated( false )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~LIB_LOGGER()
|
||||||
|
{
|
||||||
|
if( m_activated )
|
||||||
|
wxLog::SetActiveTarget( m_previousLogger );
|
||||||
|
}
|
||||||
|
|
||||||
void Activate()
|
void Activate()
|
||||||
{
|
{
|
||||||
|
m_activated = true;
|
||||||
m_previousLogger = wxLog::GetActiveTarget();
|
m_previousLogger = wxLog::GetActiveTarget();
|
||||||
wxLog::SetActiveTarget( this );
|
wxLog::SetActiveTarget( this );
|
||||||
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Flush() override
|
void Flush() override
|
||||||
|
@ -62,12 +74,12 @@ public:
|
||||||
"to adjust paths and add or remove libraries." ) );
|
"to adjust paths and add or remove libraries." ) );
|
||||||
|
|
||||||
wxLogGui::Flush();
|
wxLogGui::Flush();
|
||||||
wxLog::SetActiveTarget( m_previousLogger );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxLog* m_previousLogger;
|
wxLog* m_previousLogger;
|
||||||
|
bool m_activated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue