From a0dc92304296fda70112eb5499682fb27e41077d Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 23 Sep 2021 22:30:13 -0700 Subject: [PATCH] Qt: Fix corrupted savestate and fatal error text --- CHANGES | 1 + src/platform/qt/CoreController.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 8e9555164..ae968430f 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,7 @@ Other fixes: - 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: Remove potentially deadlocking optimization + - Qt: Fix corrupted savestate and fatal error text 0.9.2: (2021-07-10) Emulation fixes: diff --git a/src/platform/qt/CoreController.cpp b/src/platform/qt/CoreController.cpp index 81b7b3ad5..e22d30fb1 100644 --- a/src/platform/qt/CoreController.cpp +++ b/src/platform/qt/CoreController.cpp @@ -183,13 +183,16 @@ 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) { - QMetaObject::invokeMethod(controller, "crashed", Q_ARG(const QString&, QString().vsprintf(format, args))); + QMetaObject::invokeMethod(controller, "crashed", Q_ARG(const QString&, message)); } }; }