mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-31 08:51:29 -04:00
Fix shutdown crash
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#ifndef DUSK_MAIN_H
|
||||
#define DUSK_MAIN_H
|
||||
|
||||
namespace dusk {
|
||||
extern bool IsShuttingDown;
|
||||
}
|
||||
|
||||
#endif // DUSK_MAIN_H
|
||||
@@ -1,11 +1,20 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAudio2/JAIAudience.h"
|
||||
|
||||
#include "JSystem/JAudio2/JAISeMgr.h"
|
||||
#include "JSystem/JAudio2/JAISeqMgr.h"
|
||||
#include "JSystem/JAudio2/JAIStreamMgr.h"
|
||||
#include "dusk/main.h"
|
||||
|
||||
JAIAudience::~JAIAudience() {
|
||||
#if TARGET_PC
|
||||
if (dusk::IsShuttingDown) {
|
||||
// Those asserts down there crash on shutdown from dtors.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
JUT_ASSERT(14, ! JAISeMgr::getInstance() || ( JAISeMgr::getInstance() ->getAudience() != this ));
|
||||
JUT_ASSERT(15, ! JAISeqMgr::getInstance() || ( JAISeqMgr::getInstance() ->getAudience() != this ));
|
||||
JUT_ASSERT(16, ! JAIStreamMgr::getInstance() || ( JAIStreamMgr::getInstance() ->getAudience() != this ));
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "dusk/dusk.h"
|
||||
#include "dusk/logging.h"
|
||||
#include "dusk/time.h"
|
||||
#include "dusk/main.h"
|
||||
|
||||
#include <aurora/aurora.h>
|
||||
#include <aurora/event.h>
|
||||
@@ -73,6 +74,10 @@ const int audioHeapSize = 0x14D800;
|
||||
// =========================================================================
|
||||
#define COPYDATE_PATH "/str/Final/Release/COPYDATE"
|
||||
|
||||
#if TARGET_PC
|
||||
bool dusk::IsShuttingDown = false;
|
||||
#endif
|
||||
|
||||
s32 LOAD_COPYDATE(void*) {
|
||||
char buffer[32];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
@@ -306,6 +311,8 @@ int game_main(int argc, char* argv[]) {
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
dusk::IsShuttingDown = true;
|
||||
|
||||
aurora_shutdown();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user