Commit b390e73
committed
fix(texture): guard render-thread teardown against engine shutdown
The render-thread teardown task posted by UnregisterTexture() captures a raw
renderer pointer. If the engine shuts down before the task runs,
PostRenderThreadTask() runs it inline and the renderer may already be
destroyed, so gl_renderer->OnMakeCurrent() could touch a dangling GL
context/renderer.
Guard the OnMakeCurrent() call with engine->IsRunning(). UnregisterExternalTexture()
stays unconditional: it is null-safe at the embedder boundary (a torn-down
engine handle just yields an error return) and is the registrar's core
teardown step, so guarding it would skip the mandatory unregistration in the
non-running case (and breaks the RegisterUnregisterTexture unit test, whose
engine is never run).
Also reflow the FlutterDesktopTextureRegistrarUnregisterExternalTexture call
to satisfy clang-format.1 parent 4cd6db1 commit b390e73
2 files changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
334 | | - | |
| 333 | + | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
| |||
0 commit comments