diff --git a/src/debugsymboltable.cpp b/src/debugsymboltable.cpp index b8f85441..b1f0e553 100644 --- a/src/debugsymboltable.cpp +++ b/src/debugsymboltable.cpp @@ -77,17 +77,19 @@ int debugSymbolPage_t::deleteSymbolAtOffset( int ofs ) 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() ) { symNameMap.erase(itName); } } - delete it->second; symMap.erase(it); + delete sym; return 0; } diff --git a/src/drivers/Qt/SymbolicDebug.cpp b/src/drivers/Qt/SymbolicDebug.cpp index 0cbdcafd..1a9bf21e 100644 --- a/src/drivers/Qt/SymbolicDebug.cpp +++ b/src/drivers/Qt/SymbolicDebug.cpp @@ -867,8 +867,8 @@ int SymbolEditWindow::exec(void) { sym->updateName( nameEntry->text().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 FCEU_WRAPPER_UNLOCK();