diff options
author | Jonathan G Rennison <j.g.rennison@gmail.com> | 2021-04-05 21:32:48 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-04-10 18:31:42 +0200 |
commit | fbd0a2e65a5563e8f8059aae1adb0f375f2d3348 (patch) | |
tree | 6b371bbcc7888c214c7fbf3de169f627e3612899 /src/video | |
parent | c6781cbd44f5b6b9fb473caa01dcd4e325b05a7b (diff) | |
download | openttd-fbd0a2e65a5563e8f8059aae1adb0f375f2d3348.tar.xz |
Fix: Thread unsafe use of sprite cache in OpenGLBackend::DrawMouseCursor
See also: #8870
See also: #8977
Diffstat (limited to 'src/video')
-rw-r--r-- | src/video/opengl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index e74ab7b5b..c346fd152 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -1060,9 +1060,9 @@ void OpenGLBackend::DrawMouseCursor() /* Sprites are cached by PopulateCursorCache(). */ if (this->cursor_cache.Contains(sprite)) { - const Sprite *spr = GetSprite(sprite, ST_NORMAL); + Sprite *spr = this->cursor_cache.Get(sprite); - this->RenderOglSprite((OpenGLSprite *)this->cursor_cache.Get(sprite)->data, _cursor.sprite_seq[i].pal, + this->RenderOglSprite((OpenGLSprite *)spr->data, _cursor.sprite_seq[i].pal, _cursor.pos.x + _cursor.sprite_pos[i].x + UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI), _cursor.pos.y + _cursor.sprite_pos[i].y + UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI), ZOOM_LVL_GUI); |