PNS Log Viewer: Fix crash on exit

m_board needs to be deleted before m_logFile
This commit is contained in:
Roberto Fernandez Bautista 2023-08-08 23:31:37 +02:00
parent bdecdce1b4
commit 54bcd1d5ca
1 changed files with 5 additions and 1 deletions

View File

@ -180,6 +180,9 @@ PNS_LOG_VIEWER_FRAME::PNS_LOG_VIEWER_FRAME( wxFrame* frame ) : PNS_LOG_VIEWER_FR
PNS_LOG_VIEWER_FRAME::~PNS_LOG_VIEWER_FRAME()
{
m_board = nullptr;
m_logPlayer = nullptr;
m_logFile = nullptr;
m_overlay = nullptr;
}
@ -318,11 +321,12 @@ void PNS_LOG_VIEWER_FRAME::drawLoggedItems( int iter )
void PNS_LOG_VIEWER_FRAME::SetLogFile( PNS_LOG_FILE* aLog )
{
m_logPlayer.reset( new PNS_LOG_PLAYER );
m_board = nullptr;
m_logFile.reset( aLog );
SetBoard( m_logFile->GetBoard() );
m_logPlayer.reset( new PNS_LOG_PLAYER );
m_logPlayer->ReplayLog( m_logFile.get(), 0, 0, -1);
auto dbgd = m_logPlayer->GetDebugDecorator();