Fixed ASAN error in debug symbol delete.

This commit is contained in:
harry 2023-02-04 15:40:52 -05:00
parent 575b019659
commit b3386027bd
2 changed files with 6 additions and 4 deletions

View File

@ -77,17 +77,19 @@ int debugSymbolPage_t::deleteSymbolAtOffset( int ofs )
if ( it != symMap.end() ) if ( it != symMap.end() )
{ {
if ( it->second->name().size() > 0 ) auto sym = it->second;
if ( sym->name().size() > 0 )
{ {
auto itName = symNameMap.find( it->second->name() ); auto itName = symNameMap.find( sym->name() );
if ( itName != symNameMap.end() ) if ( itName != symNameMap.end() )
{ {
symNameMap.erase(itName); symNameMap.erase(itName);
} }
} }
delete it->second;
symMap.erase(it); symMap.erase(it);
delete sym;
return 0; return 0;
} }

View File

@ -867,8 +867,8 @@ int SymbolEditWindow::exec(void)
{ {
sym->updateName( nameEntry->text().toStdString().c_str() ); sym->updateName( nameEntry->text().toStdString().c_str() );
sym->commentAssign( commentEntry->toPlainText().toStdString().c_str() ); sym->commentAssign( commentEntry->toPlainText().toStdString().c_str() );
sym->trimTrailingSpaces();
} }
sym->trimTrailingSpaces();
} }
debugSymbolTable.save(); // Save table to disk immediately after an add, edit, or delete debugSymbolTable.save(); // Save table to disk immediately after an add, edit, or delete
FCEU_WRAPPER_UNLOCK(); FCEU_WRAPPER_UNLOCK();