From 8657f7c2a2fbcbce52b744de50159ac5cdcc0ae8 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 21 May 2022 17:17:24 +0300 Subject: [PATCH] Fix a segfault caused by animated desks and switching to area without a desk (#718) * Fix a segfault caused by animated desks because aolayer did not make sure that movie_delays is not empty This happened because kill() did not actually reset the max_frames. Fix that too. * do the thingy longbyte said --- src/aolayer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/aolayer.cpp b/src/aolayer.cpp index ba7f2cb..badf635 100644 --- a/src/aolayer.cpp +++ b/src/aolayer.cpp @@ -383,9 +383,9 @@ void AOLayer::play() this->freeze(); } else { - while (movie_delays.size() <= frame) { - frameAdded.wait(&mutex); - } + while (movie_delays.size() <= frame) { + frameAdded.wait(&mutex); + } ticker->start(this->get_frame_delay(movie_delays[frame])); } } @@ -531,6 +531,8 @@ void AOLayer::kill() this->clear(); movie_frames.clear(); movie_delays.clear(); + last_max_frames = max_frames; + max_frames = 0; last_path = ""; }