Report unloadable trace files on the command line instead of crashing.

Version and integrity checks throw from the View constructor, which
was outside the try/catch guarding the file open, so a bad argv trace
terminated the process. Catch and report it there as well.
This commit is contained in:
Bartosz Taudul
2026-09-12 20:48:08 +02:00
parent 1c50138f85
commit 27f12a4eb5

View File

@@ -407,7 +407,16 @@ int main( int argc, char** argv )
EM_ASM( alert( UTF8ToString( $0 ) ), msg.c_str() );
}
#else
view.store( std::make_shared<tracy::View>( RunOnMainThread, *initFileOpen, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_achievements ), std::memory_order_release );
try
{
view.store( std::make_shared<tracy::View>( RunOnMainThread, *initFileOpen, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_achievements ), std::memory_order_release );
}
catch( const std::exception& e )
{
fprintf( stderr, "Cannot load trace file: %s\n", e.what() );
initFileOpen.reset();
_Exit( 1 );
}
#endif
initFileOpen.reset();
}