mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 19:45:07 +00:00
EMI: Fix VisibleActors crash with free'd actor
This commit is contained in:
parent
e31fbe6182
commit
1551775b63
@ -1252,7 +1252,7 @@ bool Actor::updateTalk(uint frameTime) {
|
||||
if (m == GrimEngine::TextOnly && !textObject) {
|
||||
shutUp();
|
||||
return false;
|
||||
} else if (m != GrimEngine::TextOnly && (strlen(_talkSoundName.c_str()) == 0 || !g_sound->getSoundStatus(_talkSoundName.c_str()))) {
|
||||
} else if (m != GrimEngine::TextOnly && (_talkSoundName.empty() || !g_sound->getSoundStatus(_talkSoundName.c_str()))) {
|
||||
_talkDelay -= frameTime;
|
||||
if (_talkDelay <= 0) {
|
||||
_talkDelay = 0;
|
||||
|
@ -111,6 +111,7 @@ void Lua_V2::UnloadActor() {
|
||||
// This should be safe.
|
||||
delete actor;
|
||||
g_grim->invalidateActiveActorsList();
|
||||
g_grim->immediatelyRemoveActor(actor);
|
||||
}
|
||||
|
||||
void Lua_V2::SetActorWalkRate() {
|
||||
|
@ -1071,6 +1071,11 @@ void GrimEngine::invalidateActiveActorsList() {
|
||||
_buildActiveActorsList = true;
|
||||
}
|
||||
|
||||
void GrimEngine::immediatelyRemoveActor(Actor *actor) {
|
||||
_activeActors.remove(actor);
|
||||
_talkingActors.remove(actor);
|
||||
}
|
||||
|
||||
void GrimEngine::buildActiveActorsList() {
|
||||
if (!_buildActiveActorsList) {
|
||||
return;
|
||||
|
@ -162,6 +162,7 @@ public:
|
||||
*/
|
||||
void addTalkingActor(Actor *actor);
|
||||
bool areActorsTalking() const;
|
||||
void immediatelyRemoveActor(Actor *actor);
|
||||
|
||||
void setMovieSubtitle(TextObject *to);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user