[Scummvm-git-logs] scummvm master -> fba843ec0842c7946e305432406136faab7e7633

aquadran noreply at scummvm.org
Sat Jun 25 22:01:33 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fba843ec08 WINTERMUTE: WME3D: Added few missing cleanup entries, code match with original


Commit: fba843ec0842c7946e305432406136faab7e7633
    https://github.com/scummvm/scummvm/commit/fba843ec0842c7946e305432406136faab7e7633
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-06-26T00:01:29+02:00

Commit Message:
WINTERMUTE: WME3D: Added few missing cleanup entries, code match with original

Changed paths:
    engines/wintermute/ad/ad_actor_3dx.cpp
    engines/wintermute/ad/ad_object_3d.cpp
    engines/wintermute/ad/ad_scene.cpp
    engines/wintermute/base/gfx/x/animation_channel.cpp


diff --git a/engines/wintermute/ad/ad_actor_3dx.cpp b/engines/wintermute/ad/ad_actor_3dx.cpp
index 06de2bf1527..7b749c050dc 100644
--- a/engines/wintermute/ad/ad_actor_3dx.cpp
+++ b/engines/wintermute/ad/ad_actor_3dx.cpp
@@ -114,11 +114,12 @@ AdActor3DX::~AdActor3DX() {
 	_transitionTimes.clear();
 
 	delete _path2D;
+	_path2D = nullptr;
 	delete _path3D;
+	_path3D = nullptr;
 
 	delete _targetPoint2D;
-
-	delete _modelX;
+	_targetPoint2D = nullptr;
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -1154,13 +1155,15 @@ bool AdActor3DX::loadBuffer(byte *buffer, bool complete) {
 
 		case TOKEN_WAYPOINTS: {
 			delete _wptGroup;
+			_wptGroup = nullptr;
 			delete _currentWptGroup;
+			_currentWptGroup = nullptr;
 			AdWaypointGroup *wpt = new AdWaypointGroup(_gameRef);
 			AdWaypointGroup *cwpt = new AdWaypointGroup(_gameRef);
 			if (!wpt || !cwpt || !wpt->loadBuffer((char *)params, false)) {
 				delete _wptGroup;
-				delete _currentWptGroup;
 				_wptGroup = nullptr;
+				delete _currentWptGroup;
 				_currentWptGroup = nullptr;
 				cmd = PARSERR_GENERIC;
 			} else {
diff --git a/engines/wintermute/ad/ad_object_3d.cpp b/engines/wintermute/ad/ad_object_3d.cpp
index 0107bd37f51..ce2c6a4ee1f 100644
--- a/engines/wintermute/ad/ad_object_3d.cpp
+++ b/engines/wintermute/ad/ad_object_3d.cpp
@@ -67,6 +67,7 @@ AdObject3D::AdObject3D(BaseGame *inGame) : AdObject(inGame) {
 AdObject3D::~AdObject3D() {
 	_tempSkelAnim = nullptr; // ref only
 	delete _shadowVolume;
+	_shadowVolume = nullptr;
 
 	clearIgnoredLights();
 }
diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp
index 87b26e4ef8a..9996bd73f8d 100644
--- a/engines/wintermute/ad/ad_scene.cpp
+++ b/engines/wintermute/ad/ad_scene.cpp
@@ -64,6 +64,7 @@
 #include "engines/wintermute/ad/ad_actor_3dx.h"
 #include "engines/wintermute/ad/ad_scene_geometry.h"
 #include "engines/wintermute/base/gfx/opengl/base_render_opengl3d.h"
+#include "engines/wintermute/base/gfx/3ds/camera3d.h"
 #include "engines/wintermute/base/gfx/3ds/light3d.h"
 #endif
 
@@ -210,6 +211,7 @@ void AdScene::cleanup() {
 	_objects.clear();
 #ifdef ENABLE_WME3D
 	delete _sceneGeometry;
+	_sceneGeometry = nullptr;
 #endif
 	delete _viewport;
 	_viewport = nullptr;
@@ -816,6 +818,7 @@ bool AdScene::loadBuffer(char *buffer, bool complete) {
 #ifdef ENABLE_WME3D
 		case TOKEN_GEOMETRY:
 			delete _sceneGeometry;
+			_sceneGeometry = nullptr;
 			if (!_gameRef->_useD3D) {
 				break;
 			}
diff --git a/engines/wintermute/base/gfx/x/animation_channel.cpp b/engines/wintermute/base/gfx/x/animation_channel.cpp
index 997e1119244..8617b6a1e14 100644
--- a/engines/wintermute/base/gfx/x/animation_channel.cpp
+++ b/engines/wintermute/base/gfx/x/animation_channel.cpp
@@ -45,7 +45,9 @@ AnimationChannel::AnimationChannel(BaseGame *inGame, ModelX *model) : BaseClass(
 //////////////////////////////////////////////////////////////////////////
 AnimationChannel::~AnimationChannel() {
 	delete _anim[0];
+	_anim[0] = nullptr;
 	delete _anim[1];
+	_anim[1] = nullptr;
 
 	_model = nullptr; // ref only
 }
@@ -62,8 +64,8 @@ bool AnimationChannel::playAnim(AnimationSet *animSet, uint32 transitionTime, ui
 
 	if (transitionTime == 0) {
 		delete _anim[0];
-		delete _anim[1];
 		_anim[0] = nullptr;
+		delete _anim[1];
 		_anim[1] = nullptr;
 
 		_anim[0] = anim;
@@ -93,8 +95,8 @@ bool AnimationChannel::stopAnim(uint32 transitionTime) {
 	if (transitionTime == 0 || !_anim[0]) {
 		_transitioning = false;
 		delete _anim[0];
-		delete _anim[1];
 		_anim[0] = nullptr;
+		delete _anim[1];
 		_anim[1] = nullptr;
 	} else {
 		delete _anim[1];




More information about the Scummvm-git-logs mailing list