Commit e00b341
committed
GFX/DISPLAY: Move gfx_display_draw_bg coords to caller stack
The video_coords struct filled by gfx_display_draw_bg is stored in
the caller's draw struct and read after the function returns, so it
must outlive the call. Previously this was a function-scope static,
which worked but was shared mutable state — racy under threaded
video when multiple draws overlap.
Make coords a parameter, and have each caller declare it as a stack
local alongside its existing gfx_display_ctx_draw_t draw. Per-frame,
per-caller ownership: no dangling pointer, no shared state.
Resolves the thread-safety concern from 0abe6dc without the
use-after-return bug that 904c384 reverted.1 parent fae7936 commit e00b341
4 files changed
Lines changed: 19 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
464 | | - | |
465 | 465 | | |
466 | 466 | | |
467 | 467 | | |
468 | | - | |
| 468 | + | |
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
486 | 486 | | |
487 | | - | |
| 487 | + | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
250 | 253 | | |
251 | 254 | | |
252 | 255 | | |
| 256 | + | |
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6211 | 6211 | | |
6212 | 6212 | | |
6213 | 6213 | | |
| 6214 | + | |
6214 | 6215 | | |
6215 | 6216 | | |
6216 | | - | |
| 6217 | + | |
6217 | 6218 | | |
6218 | 6219 | | |
6219 | 6220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7372 | 7372 | | |
7373 | 7373 | | |
7374 | 7374 | | |
| 7375 | + | |
7375 | 7376 | | |
7376 | 7377 | | |
7377 | 7378 | | |
| |||
7400 | 7401 | | |
7401 | 7402 | | |
7402 | 7403 | | |
7403 | | - | |
| 7404 | + | |
7404 | 7405 | | |
7405 | 7406 | | |
7406 | 7407 | | |
| |||
7412 | 7413 | | |
7413 | 7414 | | |
7414 | 7415 | | |
7415 | | - | |
| 7416 | + | |
7416 | 7417 | | |
7417 | 7418 | | |
7418 | 7419 | | |
| |||
7473 | 7474 | | |
7474 | 7475 | | |
7475 | 7476 | | |
| 7477 | + | |
7476 | 7478 | | |
7477 | 7479 | | |
7478 | 7480 | | |
| |||
7496 | 7498 | | |
7497 | 7499 | | |
7498 | 7500 | | |
7499 | | - | |
| 7501 | + | |
7500 | 7502 | | |
7501 | 7503 | | |
7502 | 7504 | | |
| |||
0 commit comments