Changeset - r25154:b4a9d3c7eca0
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 3 years ago 2021-04-05 20:32:48
j.g.rennison@gmail.com
Fix: Thread unsafe use of sprite cache in OpenGLBackend::DrawMouseCursor

See also: #8870
See also: #8977
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/video/opengl.cpp
Show inline comments
 
@@ -1051,27 +1051,27 @@ void OpenGLBackend::Paint()
 
/**
 
 * Draw mouse cursor on screen.
 
 */
 
void OpenGLBackend::DrawMouseCursor()
 
{
 
	/* Draw cursor on screen */
 
	_cur_dpi = &_screen;
 
	for (uint i = 0; i < _cursor.sprite_count; ++i) {
 
		SpriteID sprite = _cursor.sprite_seq[i].sprite;
 

	
 
		/* 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);
 
		}
 
	}
 
}
 

	
 
void OpenGLBackend::PopulateCursorCache()
 
{
 
	if (this->clear_cursor_cache) {
 
		/* We have a pending cursor cache clear to do first. */
 
		this->clear_cursor_cache = false;
0 comments (0 inline, 0 general)