Move saving user data to a separate function.

This commit is contained in:
Bartosz Taudul
2026-06-05 15:58:07 +02:00
parent f5526d01a2
commit aeda64d36b
2 changed files with 10 additions and 5 deletions

View File

@@ -115,11 +115,7 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
View::~View()
{
m_worker.Shutdown();
m_userData.StoreState( m_vd );
m_userData.StoreAnnotations( m_annotations );
m_userData.StoreSourceSubstitutions( m_sourceSubstitutions );
m_userData.Save();
SaveUserData();
if( m_compare.loadThread.joinable() ) m_compare.loadThread.join();
if( m_saveThread.joinable() ) m_saveThread.join();
@@ -156,6 +152,14 @@ void View::Achieve( const char* id )
m_achievementsMgr->Achieve( id );
}
void View::SaveUserData()
{
m_userData.StoreState( m_vd );
m_userData.StoreAnnotations( m_annotations );
m_userData.StoreSourceSubstitutions( m_sourceSubstitutions );
m_userData.Save();
}
void View::ViewSource( const char* fileName, int line )
{
assert( fileName );

View File

@@ -269,6 +269,7 @@ private:
void InitTextEditor();
void SetupConfig();
void Achieve( const char* id );
void SaveUserData();
bool DrawImpl();
void DrawFrameImage( FrameImageCache& cache, const FrameImage& fi, float scale = GetScale() );