Partially fix data race issues around _cur_palette

See: https://github.com/OpenTTD/OpenTTD/issues/8712
This commit is contained in:
Jonathan G Rennison
2021-04-05 22:35:51 +01:00
parent e9186308e9
commit f2bfcc5524
2 changed files with 8 additions and 6 deletions

View File

@@ -141,6 +141,7 @@ bool VideoDriver_SDL_OpenGL::AllocateBackingStore(int w, int h, bool force)
_cur_palette.first_dirty = 0;
_cur_palette.count_dirty = 256;
this->local_palette = _cur_palette;
_cur_palette.count_dirty = 0;
return res;
}
@@ -165,7 +166,7 @@ void VideoDriver_SDL_OpenGL::Paint()
{
PerformanceMeasurer framerate(PFE_VIDEO);
if (_cur_palette.count_dirty != 0) {
if (this->local_palette.count_dirty != 0) {
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
/* Always push a changed palette to OpenGL. */
@@ -174,7 +175,7 @@ void VideoDriver_SDL_OpenGL::Paint()
blitter->PaletteAnimate(this->local_palette);
}
_cur_palette.count_dirty = 0;
this->local_palette.count_dirty = 0;
}
OpenGLBackend::Get()->Paint();