From 00e00e2c40e9ff02d962da965f0c68ad62d1dca0 Mon Sep 17 00:00:00 2001 From: AdventureT Date: Thu, 7 Dec 2023 18:22:53 +0100 Subject: [PATCH] Minor Changes --- Tools/UnitTests/Source/main.cpp | 12 +++++++++++- Toshi/Include/TKernel/TNodeTree.h | 1 + Toshi/Source/TKernel/TTask.cpp | 16 +++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Tools/UnitTests/Source/main.cpp b/Tools/UnitTests/Source/main.cpp index f329705..e87be2b 100644 --- a/Tools/UnitTests/Source/main.cpp +++ b/Tools/UnitTests/Source/main.cpp @@ -5,6 +5,16 @@ TOSHI_NAMESPACE_USING class AApplication : public Toshi::TApplication { + virtual TBOOL OnCreate(TINT argc, TPCHAR* const argv) override + { + return TApplication::OnCreate(argc, argv); + } + + virtual TBOOL OnUpdate(TFLOAT a_fDelta) + { + // Skip Updating + return TFALSE; + } }; static AApplication g_oTheApp; @@ -13,7 +23,7 @@ int main(int argc, char* argv[]) { int result; if (g_oTheApp.Create("UnitTests", argc, argv)) { - //g_oTheApp.Execute(); + g_oTheApp.Execute(); result = Catch::Session().run(argc, argv); } diff --git a/Toshi/Include/TKernel/TNodeTree.h b/Toshi/Include/TKernel/TNodeTree.h index b6d14ea..f954c4d 100644 --- a/Toshi/Include/TKernel/TNodeTree.h +++ b/Toshi/Include/TKernel/TNodeTree.h @@ -138,6 +138,7 @@ class TNodeTree // Check if the node belongs to the current tree if (nodeRoot != this) { + TASSERT(!"A node is being removed from a different tree from it's current tree."); return &node; } diff --git a/Toshi/Source/TKernel/TTask.cpp b/Toshi/Source/TKernel/TTask.cpp index f7834d2..995a49e 100644 --- a/Toshi/Source/TKernel/TTask.cpp +++ b/Toshi/Source/TKernel/TTask.cpp @@ -7,7 +7,21 @@ IMPLEMENT_DYNAMIC(TTask, TObject); TBOOL TTask::Create() { TASSERT(IsCreated()==TFALSE); - return TBOOL(); + if (!IsCreated()) { + if (!OnCreate()) { + OnDestroy(); + m_Tree->Remove(this, TFALSE); + Delete(); + + return TFALSE; + } + + //auto oldState = m_State; + //m_State |= State_Created; + //Activate(TTRUE); + } + + return TTRUE; } TBOOL TTask::CreateFailed()