mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
GRIM/EMI: Draw movie subtitles while holding frame lock
This prevents a crash that occurs if the movie player deletes the active subtitle while the main loop is still in the process of drawing it.
This commit is contained in:
parent
8c95812106
commit
49a4de702f
@ -619,9 +619,9 @@ void GrimEngine::updateDisplayScene() {
|
||||
}
|
||||
// Draw Primitives
|
||||
_iris->draw();
|
||||
if (_movieSubtitle) {
|
||||
_movieSubtitle->draw();
|
||||
}
|
||||
|
||||
g_movie->drawMovieSubtitle();
|
||||
|
||||
} else if (_mode == NormalMode || _mode == OverworldMode) {
|
||||
updateNormalMode();
|
||||
} else if (_mode == DrawMode) {
|
||||
@ -1356,6 +1356,11 @@ void GrimEngine::setMovieSubtitle(TextObject *to) {
|
||||
}
|
||||
}
|
||||
|
||||
void GrimEngine::drawMovieSubtitle() {
|
||||
if (_movieSubtitle)
|
||||
_movieSubtitle->draw();
|
||||
}
|
||||
|
||||
void GrimEngine::setMovieSetup() {
|
||||
_movieSetup = _currSet->getCurrSetup()->_name;
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ public:
|
||||
bool areActorsTalking() const;
|
||||
void immediatelyRemoveActor(Actor *actor);
|
||||
|
||||
void drawMovieSubtitle();
|
||||
void setMovieSubtitle(TextObject *to);
|
||||
void setMovieSetup();
|
||||
|
||||
|
@ -123,6 +123,11 @@ Graphics::Surface *MoviePlayer::getDstSurface() {
|
||||
return _externalSurface;
|
||||
}
|
||||
|
||||
void MoviePlayer::drawMovieSubtitle() {
|
||||
Common::StackLock lock(_frameMutex);
|
||||
g_grim->drawMovieSubtitle();
|
||||
}
|
||||
|
||||
void MoviePlayer::init() {
|
||||
if (!_timerStarted) {
|
||||
g_system->getTimerManager()->installTimerProc(&timerCallback, 10000, this, "movieLoop");
|
||||
|
@ -79,6 +79,9 @@ public:
|
||||
virtual void clearUpdateNeeded() { _updateNeeded = false; }
|
||||
virtual int32 getMovieTime() { return (int32)_movieTime; }
|
||||
|
||||
/* Draw the subtitles, guarded by _drawMutex */
|
||||
void drawMovieSubtitle();
|
||||
|
||||
/**
|
||||
* Saves the state of the video to a savegame
|
||||
* @param state The state to save to
|
||||
|
Loading…
x
Reference in New Issue
Block a user