Fix shutdown crash on debug builds

The destruction of these crashed due to dereferencing an invalid pointer. Not making them inline fixes the problem. This problem only occurred on debug builds, other build configurations were not affected.
This commit is contained in:
Kawe Mazidjatari 2023-06-18 23:55:58 +02:00
parent 165d80c541
commit f87fb2b2d6
4 changed files with 11 additions and 4 deletions

View File

@ -4,6 +4,9 @@
std::shared_ptr<spdlog::logger> g_TermLogger;
std::shared_ptr<spdlog::logger> g_ImGuiLogger;
std::ostringstream g_LogStream;
std::shared_ptr<spdlog::sinks::ostream_sink_st> g_LogSink;
//#############################################################################
// SPDLOG INIT
//#############################################################################
@ -24,6 +27,7 @@ void SpdLog_Init(void)
* IMGUI LOGGER SETUP *
************************/
{
g_LogSink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_LogStream);
g_ImGuiLogger = std::make_shared<spdlog::logger>("game_console", g_LogSink);
spdlog::register_logger(g_ImGuiLogger); // in-game console logger.
g_ImGuiLogger->set_pattern("[0.000] %v");

View File

@ -21,8 +21,8 @@ extern std::shared_ptr<spdlog::logger> g_ImGuiLogger;
//-------------------------------------------------------------------------
// IMGUI CONSOLE SINK |
inline std::ostringstream g_LogStream;
inline auto g_LogSink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_LogStream);
extern std::ostringstream g_LogStream;
extern std::shared_ptr<spdlog::sinks::ostream_sink_st> g_LogSink;
void SpdLog_Init(void);
void SpdLog_Create(void);

View File

@ -15,6 +15,9 @@
#include "rtech/rtech_utils.h"
#include "public/studio.h"
RMDLFallBack_t* g_pMDLFallback = new RMDLFallBack_t();
std::unordered_set<MDLHandle_t> g_vBadMDLHandles;
//-----------------------------------------------------------------------------
// Purpose: finds an MDL

View File

@ -60,8 +60,8 @@ struct studiodata_t
int m_nGuidLock; // always -1, set to 1 and 0 in CMDLCache::FindUncachedMDL.
};
inline RMDLFallBack_t* g_pMDLFallback = new RMDLFallBack_t();
inline std::unordered_set<MDLHandle_t> g_vBadMDLHandles;
extern RMDLFallBack_t* g_pMDLFallback;
extern std::unordered_set<MDLHandle_t> g_vBadMDLHandles;
class CMDLCache
{