diff --git a/CHANGES b/CHANGES index dcd5f9edf..de7213408 100644 --- a/CHANGES +++ b/CHANGES @@ -27,6 +27,7 @@ Other fixes: - GB Video: Fix memory leak when reseting SGB games - GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB - Libretro: Fix crash when using Game Boy codes (fixes mgba.io/i/2281) + - Qt: Fix corrupted savestate and fatal error text Misc: - Core: Suspend runloop when a core crashes - mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871) diff --git a/src/platform/qt/CoreController.cpp b/src/platform/qt/CoreController.cpp index 58ba1797d..b71b611ea 100644 --- a/src/platform/qt/CoreController.cpp +++ b/src/platform/qt/CoreController.cpp @@ -183,14 +183,17 @@ CoreController::CoreController(mCore* core, QObject* parent) return; } } - message = QString().vsprintf(format, args); + va_list argc; + va_copy(argc, args); + message = QString().vsprintf(format, argc); + va_end(argc); QMetaObject::invokeMethod(controller, "statusPosted", Q_ARG(const QString&, message)); } message = QString().vsprintf(format, args); QMetaObject::invokeMethod(controller, "logPosted", Q_ARG(int, level), Q_ARG(int, category), Q_ARG(const QString&, message)); if (level == mLOG_FATAL) { mCoreThreadMarkCrashed(controller->thread()); - QMetaObject::invokeMethod(controller, "crashed", Q_ARG(const QString&, QString().vsprintf(format, args))); + QMetaObject::invokeMethod(controller, "crashed", Q_ARG(const QString&, message)); } }; }