Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9954808

Browse files
committed
[Impeller] Guard execution of ReactorGLES operations with a mutex
Both the raster and IO threads can flush the ops queue. The reactor must ensure that execution of queued ops is serialized. Fixes flutter/flutter#135524
1 parent f9f937e commit 9954808

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

impeller/renderer/backend/gles/reactor_gles.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ bool ReactorGLES::React() {
159159
}
160160
TRACE_EVENT0("impeller", "ReactorGLES::React");
161161
while (HasPendingOperations()) {
162+
// Both the raster thread and the IO thread can flush queued operations.
163+
// Ensure that execution of the ops is serialized.
164+
Lock execution_lock(ops_execution_mutex_);
165+
162166
if (!ReactOnce()) {
163167
return false;
164168
}

impeller/renderer/backend/gles/reactor_gles.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class ReactorGLES {
6969

7070
std::unique_ptr<ProcTableGLES> proc_table_;
7171

72+
Mutex ops_execution_mutex_;
7273
mutable Mutex ops_mutex_;
7374
std::vector<Operation> ops_ IPLR_GUARDED_BY(ops_mutex_);
7475

@@ -88,7 +89,7 @@ class ReactorGLES {
8889
bool can_set_debug_labels_ = false;
8990
bool is_valid_ = false;
9091

91-
bool ReactOnce();
92+
bool ReactOnce() IPLR_REQUIRES(ops_execution_mutex_);
9293

9394
bool HasPendingOperations() const;
9495

0 commit comments

Comments
 (0)