A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.
fix(x11): update framebuffer width and height under the frame lock
ExTv4a955078a3ac
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/x11/X11ViewModel.kt b/app/src/main/java/com/excp/podroid/ui/screens/x11/X11ViewModel.ktindex 0ec0ef9..df486d3 100644--- a/app/src/main/java/com/excp/podroid/ui/screens/x11/X11ViewModel.kt+++ b/app/src/main/java/com/excp/podroid/ui/screens/x11/X11ViewModel.kt@@ -218,14 +218,15 @@ class X11ViewModel @Inject constructor(}val ns = upd.newSizeif (ns != null && (ns.w != fbW || ns.h != fbH)) {- fbW = ns.w; fbH = ns.h- val fresh = IntArray(fbW * fbH)- // Swap the framebuffer and mark the whole new frame dirty in- // the same critical section, so a recomposition between resize- // and the next full frame can't blit stale damage rects (or a+ val nw = ns.w; val nh = ns.h+ val fresh = IntArray(nw * nh)+ // Swap the framebuffer, width, and height, and mark the whole new+ // frame dirty in the same critical section, so a recomposition+ // between resize and the next full frame can't read a mismatched+ // fbW/fbH against the old array, or blit stale damage rects (or a// stale bounding box) against the new size.- synchronized(fbLock) { framebuffer = fresh; damageTracker.invalidateAll(fbW, fbH) }- scratch = IntArray(fbW * fbH)+ synchronized(fbLock) { framebuffer = fresh; fbW = nw; fbH = nh; damageTracker.invalidateAll(nw, nh) }+ scratch = IntArray(nw * nh)_fbSize.value = nscursor.value = android.graphics.Point(fbW / 2, fbH / 2)// Route through the serialized writer so this full-update