Skip to content

Commit b0fda87

Browse files
committed
[core] Changed video mutex to recursive and lock it in GUI_Drawable.
1 parent b6505b7 commit b0fda87

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ VER_MAJOR = 4
1515
VER_MINOR = 0
1616
VER_MICRO = 3
1717
# Build types: 0x0N - Alpha, 0x1N - Beta, 0x2N - RC, 0x3N - Release
18-
VER_BUILD = 0x12
18+
VER_BUILD = 0x13
1919

2020
BUILD_TYPE_BASE = $(if $(filter 0x3%,$(VER_BUILD)),Release,$(if $(filter 0x2%,$(VER_BUILD)),RC,$(if $(filter 0x1%,$(VER_BUILD)),Beta,$(if $(filter 0x0%,$(VER_BUILD)),Alpha,Release))))
2121
BUILD_NUM = $(lastword $(subst 0x2,,$(subst 0x1,,$(subst 0x0,,$(subst 0x3,,$(VER_BUILD))))))

lib/SDL_gui/Drawable.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
#include "SDL_gui.h"
66

7+
extern "C" {
8+
void LockVideo();
9+
void UnlockVideo();
10+
}
11+
712

813
static int Inside(int x, int y, SDL_Rect *r)
914
{
@@ -307,14 +312,18 @@ void GUI_Drawable::DoUpdate(int force)
307312
force = 1;
308313
}
309314
Update(force);
310-
flags &= ~WIDGET_CHANGED;
315+
if(flags & WIDGET_CHANGED) {
316+
flags &= ~WIDGET_CHANGED;
317+
}
311318
}
312319

313320
/* mark as changed so it will be drawn in the next update */
314321

315322
void GUI_Drawable::MarkChanged()
316323
{
324+
LockVideo();
317325
flags |= WIDGET_CHANGED;
326+
UnlockVideo();
318327
}
319328

320329
/* tile an image over an area on a widget */

src/video.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ int VideoIsLocked() {
338338
}
339339

340340
int VideoMustLock() {
341-
return (video_inited && video_thd != thd_get_current());
341+
return video_inited;
342342
}
343343

344344
void LockVideo() {
@@ -476,7 +476,7 @@ int InitVideo(int w, int h, int bpp) {
476476
video_dma = 0;
477477
}
478478

479-
mutex_init((mutex_t *)&video_mutex, MUTEX_TYPE_NORMAL);
479+
mutex_init(&video_mutex, MUTEX_TYPE_RECURSIVE);
480480
return 1;
481481
}
482482

0 commit comments

Comments
 (0)