Commit 2b81261
committed
fix(windows): prevent use-after-free crash in Skia bitmap during dispose
asComposeImageBitmap() shares native pixel memory with the source Bitmap.
When dispose() closed the double-buffer bitmaps, Compose could still be
rendering the last frame on the AWT-EventQueue thread, causing Skia's
_nMakeFromBitmap to read freed memory (EXCEPTION_ACCESS_VIOLATION in
skiko-windows-x64.dll).
Instead of calling close() explicitly, nullify references and let the
Skia Managed cleaner free them once all holders (including Compose)
drop their references.1 parent f161bb7 commit 2b81261
1 file changed
Lines changed: 8 additions & 20 deletions
File tree
- mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/windows
Lines changed: 8 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | 349 | | |
357 | 350 | | |
358 | 351 | | |
359 | | - | |
360 | | - | |
361 | | - | |
| 352 | + | |
362 | 353 | | |
363 | 354 | | |
364 | 355 | | |
| |||
391 | 382 | | |
392 | 383 | | |
393 | 384 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | 385 | | |
402 | 386 | | |
403 | 387 | | |
404 | | - | |
405 | | - | |
406 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
407 | 395 | | |
408 | 396 | | |
409 | 397 | | |
| |||
0 commit comments