Skip to content

Commit d771eb3

Browse files
committed
fix(renderer.c): ensure buffer list is not being modified in other thread.
1 parent b61b564 commit d771eb3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/src/main/cpp/lorie/renderer.c

+3
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,10 @@ static void drawCursor(float displayWidth, float displayHeight);
518518

519519
void rendererRedrawLocked(JNIEnv* env) {
520520
EGLSync fence;
521+
// The buffer will not be released until this function ends, but main thread can modify buffer list
522+
pthread_mutex_lock(&stateLock);
521523
LorieBuffer *buffer = LorieBufferList_findById(&buffers, state->rootWindowTextureID);
524+
pthread_mutex_unlock(&stateLock);
522525
if (!buffer) {
523526
log("Buffer %llu not found", state->rootWindowTextureID);
524527
usleep(2); // probably other thread did not push the buffer yet.

0 commit comments

Comments
 (0)