mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use mutex to protect scrolling banner cache from data race
This commit is contained in:
parent
1153b97ace
commit
4e264bd45d
|
@ -17,6 +17,7 @@
|
|||
#include "TTF.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
/* size: 0xA12 */
|
||||
|
@ -38,6 +39,7 @@ assert_struct_size(rct_draw_scroll_text, 0xA12);
|
|||
static rct_draw_scroll_text _drawScrollTextList[MAX_SCROLLING_TEXT_ENTRIES];
|
||||
static uint8_t _characterBitmaps[FONT_SPRITE_GLYPH_COUNT + SPR_G2_GLYPH_COUNT][8];
|
||||
static uint32_t _drawSCrollNextIndex = 0;
|
||||
static std::mutex _scrollingTextMutex;
|
||||
|
||||
static void scrolling_text_set_bitmap_for_sprite(
|
||||
utf8* text, int32_t scroll, uint8_t* bitmap, const int16_t* scrollPositionOffsets);
|
||||
|
@ -1472,6 +1474,8 @@ void scrolling_text_invalidate()
|
|||
*/
|
||||
int32_t scrolling_text_setup(paint_session* session, rct_string_id stringId, uint16_t scroll, uint16_t scrollingMode)
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(_scrollingTextMutex);
|
||||
|
||||
assert(scrollingMode < MAX_SCROLLING_TEXT_MODES);
|
||||
|
||||
rct_drawpixelinfo* dpi = &session->DPI;
|
||||
|
|
Loading…
Reference in New Issue