From d7d2af4ee1c29bf2319b936c8d91df6bda2a7b8f Mon Sep 17 00:00:00 2001 From: AdventureT Date: Fri, 8 Dec 2023 13:47:22 +0100 Subject: [PATCH] Fixed TManagedPointer & TKernel null reference --- Toshi/Include/TKernel/TManagedPointer.h | 2 +- Toshi/Include/TKernel/TScheduler.h | 2 +- Toshi/Source/TKernel/TKernelInterface.cpp | 2 +- Toshi/Source/TKernel/TScheduler.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Toshi/Include/TKernel/TManagedPointer.h b/Toshi/Include/TKernel/TManagedPointer.h index 5bc02ba..ce535dd 100644 --- a/Toshi/Include/TKernel/TManagedPointer.h +++ b/Toshi/Include/TKernel/TManagedPointer.h @@ -7,7 +7,7 @@ template class TOSHI_EXPORT TManagedPointer { public: - TManagedPointer() : m_pObject(new T()) + TManagedPointer() : m_pObject(TNULL) { } diff --git a/Toshi/Include/TKernel/TScheduler.h b/Toshi/Include/TKernel/TScheduler.h index 89e4896..b54e939 100644 --- a/Toshi/Include/TKernel/TScheduler.h +++ b/Toshi/Include/TKernel/TScheduler.h @@ -14,7 +14,7 @@ class TOSHI_EXPORT TScheduler : public TObject DECLARE_DYNAMIC(TScheduler); public: - TScheduler(); + TScheduler(TKernelInterface* a_pKernel); TTask* CreateTask(TClass const& a_rTaskClass, TTask* a_pTask); void Update(); diff --git a/Toshi/Source/TKernel/TKernelInterface.cpp b/Toshi/Source/TKernel/TKernelInterface.cpp index 2235cda..cbff944 100644 --- a/Toshi/Source/TKernel/TKernelInterface.cpp +++ b/Toshi/Source/TKernel/TKernelInterface.cpp @@ -44,7 +44,7 @@ TKernelInterface::TKernelInterface(TINT argc, TPCHAR* const argv, TBOOL a_bVerbo pAbsSystem->SetPrefix(""); pFileManager->SetSystemPath("local"); - m_pScheduler = new TScheduler(); + m_pScheduler = new TScheduler(this); } TBOOL TKernelInterface::Update() diff --git a/Toshi/Source/TKernel/TScheduler.cpp b/Toshi/Source/TKernel/TScheduler.cpp index 25852ba..00cc389 100644 --- a/Toshi/Source/TKernel/TScheduler.cpp +++ b/Toshi/Source/TKernel/TScheduler.cpp @@ -9,10 +9,10 @@ TBOOL Profiler_Control_ParentStart = TFALSE; TBOOL Profiler_Control_ParentStop = TFALSE; TProfiler Profiler_Program; -TScheduler::TScheduler() +TScheduler::TScheduler(TKernelInterface* a_pKernel) { m_pCurrentTask = TNULL; - m_pKernel = TNULL; + m_pKernel = a_pKernel; m_fCurrentTimeDelta = 0.0f; m_fTotalTime = 0.0f; m_fDebugSlowTime = 1.0f;