summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2021-04-05 21:32:48 +0100
committerMichael Lutz <michi@icosahedron.de>2021-04-10 18:31:42 +0200
commitfbd0a2e65a5563e8f8059aae1adb0f375f2d3348 (patch)
tree6b371bbcc7888c214c7fbf3de169f627e3612899 /src
parentc6781cbd44f5b6b9fb473caa01dcd4e325b05a7b (diff)
downloadopenttd-fbd0a2e65a5563e8f8059aae1adb0f375f2d3348.tar.xz
Fix: Thread unsafe use of sprite cache in OpenGLBackend::DrawMouseCursor
See also: #8870 See also: #8977
Diffstat (limited to 'src')
-rw-r--r--src/video/opengl.cpp4
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);