diff options
| author | bgaldrikian <[email protected]> | 2018-10-03 17:51:20 -0700 |
|---|---|---|
| committer | bgaldrikian <[email protected]> | 2018-10-03 17:51:20 -0700 |
| commit | 6f51c0ad55f3ed33597b8b12391d426fe28a0923 (patch) | |
| tree | b132a8cb2485820ff9556dafc8e874bc9d41f255 /samples/SampleBase | |
| parent | Fixes to UnitySample to make it build & run. ( In Unity 2018.2 ) (diff) | |
| download | blast-1.1.4_rc1.tar.xz blast-1.1.4_rc1.zip | |
Blast 1.1.4. See docs/release_notes.txt.v1.1.4_rc1
Diffstat (limited to 'samples/SampleBase')
| -rwxr-xr-x | samples/SampleBase/blast/BlastController.cpp | 51 | ||||
| -rwxr-xr-x | samples/SampleBase/blast/BlastFamily.cpp | 14 |
2 files changed, 31 insertions, 34 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);
}
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)
|