impr: Only add stacktrace to exceptions thrown in main thread

This commit is contained in:
WerWolv
2025-12-02 20:00:19 +01:00
parent 5c890e710e
commit ed32439645
3 changed files with 16 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
#include <hex/api/task_manager.hpp>
#include <hex/api/plugin_manager.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/trace/exceptions.hpp>
namespace hex::init {
@@ -41,17 +42,21 @@ int main(int argc, char **argv) {
// Setup crash handlers right away to catch crashes as early as possible
crash::setupCrashHandlers();
// Enable exception tracing on the main thread
trace::enableExceptionCaptureForCurrentThread();
// Run platform-specific initialization code
Window::initNative();
// Setup messaging system to allow sending commands to the main ImHex instance
hex::messaging::setupMessaging();
messaging::setupMessaging();
// Handle command line arguments if any have been passed
if (argc > 1) {
init::runCommandLine(argc, argv);
}
// Log some system information to aid debugging when users share their logs
log::info("Welcome to ImHex {}!", ImHexApi::System::getImHexVersion().get());
log::info("Compiled using commit {}@{}", ImHexApi::System::getCommitBranch(), ImHexApi::System::getCommitHash());