[Scummvm-git-logs] scummvm master -> 1c66df6f9070d39396424ad4e081e5306c9547eb
mduggan
noreply at scummvm.org
Mon Mar 6 09:51:14 UTC 2023
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:
1c66df6f90 TETRAEDGE: Avoid another potential crash on anim finished
Commit: 1c66df6f9070d39396424ad4e081e5306c9547eb
https://github.com/scummvm/scummvm/commit/1c66df6f9070d39396424ad4e081e5306c9547eb
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-03-06T16:23:36+09:00
Commit Message:
TETRAEDGE: Avoid another potential crash on anim finished
Changed paths:
engines/tetraedge/game/character.cpp
engines/tetraedge/game/in_game_scene.cpp
diff --git a/engines/tetraedge/game/character.cpp b/engines/tetraedge/game/character.cpp
index 4842b2fde17..43d6a4abb26 100644
--- a/engines/tetraedge/game/character.cpp
+++ b/engines/tetraedge/game/character.cpp
@@ -88,6 +88,8 @@ Character::~Character() {
}
removeAnim();
for (uint s = 0; s < 2; s++) {
+ if (!_shadowModel[s])
+ continue;
for (uint i = 0; i < models.size(); i++) {
if (models[i] == _shadowModel[s]) {
models.remove_at(i);
@@ -248,6 +250,7 @@ bool Character::blendAnimation(const Common::String &animname, float amount, boo
if (_curModelAnim) {
_curModelAnim->onFinished().remove(this, &Character::onModelAnimationFinished);
_curModelAnim->unbind();
+ _curModelAnim->reset();
}
_curModelAnim = animCacheLoad(animpath);
@@ -290,6 +293,7 @@ void Character::deleteAnim() {
if (_curModelAnim) {
_curModelAnim->onFinished().remove(this, &Character::onModelAnimationFinished);
_curModelAnim->unbind();
+ _curModelAnim->reset();
}
_model->removeAnim();
_curModelAnim.release();
@@ -728,6 +732,7 @@ void Character::removeAnim() {
if (_curModelAnim) {
_curModelAnim->onFinished().remove(this, &Character::onModelAnimationFinished);
_curModelAnim->unbind();
+ _curModelAnim->reset();
}
_model->removeAnim();
if (_curModelAnim) {
@@ -762,6 +767,7 @@ bool Character::setAnimation(const Common::String &aname, bool repeat, bool retu
if (_curModelAnim) {
_curModelAnim->onFinished().remove(this, &Character::onModelAnimationFinished);
_curModelAnim->unbind();
+ _curModelAnim->reset();
}
_curModelAnim = animCacheLoad(animPath);
diff --git a/engines/tetraedge/game/in_game_scene.cpp b/engines/tetraedge/game/in_game_scene.cpp
index b69cafea936..d2c9695e14c 100644
--- a/engines/tetraedge/game/in_game_scene.cpp
+++ b/engines/tetraedge/game/in_game_scene.cpp
@@ -1615,6 +1615,9 @@ void InGameScene::unloadCharacter(const Common::String &name) {
_character->deleteLater();
_character = nullptr;
}
+
+ // NOTE: There may be multiple characters with the same
+ // model to delete here.
for (uint i = 0; i < _characters.size(); i++) {
Character *c = _characters[i];
if (c && c->_model->name() == name) {
@@ -1626,7 +1629,7 @@ void InGameScene::unloadCharacter(const Common::String &name) {
c->_model->anim()->stop(); // TODO: added this
c->setFreeMoveZone(nullptr); // TODO: added this
_characters.remove_at(i);
- break;
+ i--;
}
}
}
More information about the Scummvm-git-logs
mailing list