Qt: Fix corrupted savestate and fatal error text

This commit is contained in:
Vicki Pfau 2021-09-23 22:30:13 -07:00
parent 1c486cc30b
commit 45444d5ea3
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,7 @@ Other fixes:
- GB Video: Fix memory leak when reseting SGB games - GB Video: Fix memory leak when reseting SGB games
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB - 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) - Libretro: Fix crash when using Game Boy codes (fixes mgba.io/i/2281)
- Qt: Fix corrupted savestate and fatal error text
Misc: Misc:
- Core: Suspend runloop when a core crashes - Core: Suspend runloop when a core crashes
- mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871) - mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871)

View File

@ -183,14 +183,17 @@ CoreController::CoreController(mCore* core, QObject* parent)
return; 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)); QMetaObject::invokeMethod(controller, "statusPosted", Q_ARG(const QString&, message));
} }
message = QString().vsprintf(format, args); message = QString().vsprintf(format, args);
QMetaObject::invokeMethod(controller, "logPosted", Q_ARG(int, level), Q_ARG(int, category), Q_ARG(const QString&, message)); QMetaObject::invokeMethod(controller, "logPosted", Q_ARG(int, level), Q_ARG(int, category), Q_ARG(const QString&, message));
if (level == mLOG_FATAL) { if (level == mLOG_FATAL) {
mCoreThreadMarkCrashed(controller->thread()); mCoreThreadMarkCrashed(controller->thread());
QMetaObject::invokeMethod(controller, "crashed", Q_ARG(const QString&, QString().vsprintf(format, args))); QMetaObject::invokeMethod(controller, "crashed", Q_ARG(const QString&, message));
} }
}; };
} }