From f17fc90d7d84e51fbd8250153b6ae1823c62a4db Mon Sep 17 00:00:00 2001 From: Matej Bagar Date: Sun, 12 Jul 2026 23:46:17 +0200 Subject: [PATCH] Fix missing/white photo in forms on some android 9 devices --- app/qml/components/MMPhoto.qml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/qml/components/MMPhoto.qml b/app/qml/components/MMPhoto.qml index 68b2f31f8..3deb99abd 100644 --- a/app/qml/components/MMPhoto.qml +++ b/app/qml/components/MMPhoto.qml @@ -37,7 +37,26 @@ Image { height: root.height radius: 20 * __dp visible: false - layer.enabled: true + layer.enabled: true + } + + // On Android, backgrounding/resuming the app (e.g. while picking a photo) can tear down and + // recreate the EGL surface. If this item's layer renders while that surface is still settling, + // the resulting texture can be corrupted (seen as a blank/white photo on some Android 9 devices), + // and nothing else triggers a re-render afterwards. Force the layer to regenerate once the app + // is confirmed active again. + Connections { + target: Qt.application + function onStateChanged() { + if ( Qt.application.state === Qt.ApplicationActive ) { + root.layer.enabled = false + maskRect.layer.enabled = false + Qt.callLater( function() { + root.layer.enabled = true + maskRect.layer.enabled = true + } ) + } + } } Rectangle {