aboutsummaryrefslogtreecommitdiff
path: root/samples/SampleBase/blast/BlastController.cpp
diff options
context:
space:
mode:
authorbgaldrikian <[email protected]>2018-10-03 17:51:20 -0700
committerbgaldrikian <[email protected]>2018-10-03 17:51:20 -0700
commit6f51c0ad55f3ed33597b8b12391d426fe28a0923 (patch)
treeb132a8cb2485820ff9556dafc8e874bc9d41f255 /samples/SampleBase/blast/BlastController.cpp
parentFixes to UnitySample to make it build & run. ( In Unity 2018.2 ) (diff)
downloadarchived-blast-1.1.4_rc1.tar.xz
archived-blast-1.1.4_rc1.zip
Blast 1.1.4. See docs/release_notes.txt.v1.1.4_rc1
Diffstat (limited to 'samples/SampleBase/blast/BlastController.cpp')
-rwxr-xr-xsamples/SampleBase/blast/BlastController.cpp51
1 files changed, 21 insertions, 30 deletions
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 <PxFoundation.h>
+
+#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);
}