From 6f51c0ad55f3ed33597b8b12391d426fe28a0923 Mon Sep 17 00:00:00 2001 From: bgaldrikian Date: Wed, 3 Oct 2018 17:51:20 -0700 Subject: Blast 1.1.4. See docs/release_notes.txt. --- samples/SampleBase/blast/BlastController.cpp | 51 ++++++++++++---------------- samples/SampleBase/blast/BlastFamily.cpp | 14 +++++--- 2 files changed, 31 insertions(+), 34 deletions(-) (limited to 'samples') diff --git a/samples/SampleBase/blast/BlastController.cpp b/samples/SampleBase/blast/BlastController.cpp index e185922..a2cf5cd 100755 --- a/samples/SampleBase/blast/BlastController.cpp +++ b/samples/SampleBase/blast/BlastController.cpp @@ -64,6 +64,17 @@ #include "imgui.h" +#include + +#define SAFE_RELEASE_(p) \ + { \ + if(p) \ + { \ + (p)->release(); \ + (p) = NULL; \ + } \ + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Joint creation @@ -138,42 +149,22 @@ void BlastController::onSampleStop() removeAllFamilies(); - m_extImpactDamageManager->release(); - m_extPxManager->release(); + SAFE_RELEASE_(m_extImpactDamageManager); + SAFE_RELEASE_(m_extPxManager); SAFE_DELETE(m_eventCallback); - - m_tkGroup->release(); - - delete m_replay; - - m_tkFramework->release(); - - if (m_extGroupTaskManager != nullptr) - { - m_extGroupTaskManager->release(); - m_extGroupTaskManager = nullptr; - } - - if (m_taskManager != nullptr) - { - m_taskManager->release(); - } + SAFE_RELEASE_(m_tkGroup); + SAFE_DELETE(m_replay); + SAFE_RELEASE_(m_tkFramework); + SAFE_RELEASE_(m_extGroupTaskManager); + SAFE_RELEASE_(m_taskManager); + SAFE_RELEASE_(m_extSerialization); } void BlastController::notifyPhysXControllerRelease() { - if (m_extGroupTaskManager != nullptr) - { - m_extGroupTaskManager->release(); - m_extGroupTaskManager = nullptr; - } - - if (m_taskManager != nullptr) - { - m_taskManager->release(); - m_taskManager = nullptr; - } + SAFE_RELEASE_(m_extGroupTaskManager); + SAFE_RELEASE_(m_taskManager); } diff --git a/samples/SampleBase/blast/BlastFamily.cpp b/samples/SampleBase/blast/BlastFamily.cpp index 5d41eb7..315da5c 100755 --- a/samples/SampleBase/blast/BlastFamily.cpp +++ b/samples/SampleBase/blast/BlastFamily.cpp @@ -71,10 +71,16 @@ BlastFamily::~BlastFamily() { m_stressSolver->release(); } - - m_pxFamily->unsubscribe(m_listener); - - m_pxFamily->release(); + if (m_pxFamily) + { + m_pxFamily->unsubscribe(m_listener); + m_pxFamily->release(); + } + //Self released + //if (m_tkFamily) + //{ + // m_tkFamily->release(); + //} } void BlastFamily::initialize(const BlastAsset::ActorDesc& desc) -- cgit v1.2.3