Skip to content

Commit b891058

Browse files
committed
make sure the runOnDraw operation is thread-safe
1 parent 0a3f115 commit b891058

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/src/main/java/jp/co/cyberagent/android/gpuimage/filter/GPUImageFilter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ protected void onDrawArraysPre() {
135135
}
136136

137137
protected void runPendingOnDrawTasks() {
138-
while (!runOnDraw.isEmpty()) {
139-
runOnDraw.removeFirst().run();
138+
synchronized (runOnDraw) {
139+
while (!runOnDraw.isEmpty()) {
140+
runOnDraw.removeFirst().run();
141+
}
140142
}
141143
}
142144

0 commit comments

Comments
 (0)