From: Twaik Yont <9674930+twaik@users.noreply.github.com> Track the client connection that creates the desktop view and treat it as the lifetime owner of the Android activity. When this client (typically explorer.exe) disconnects, terminate the process to avoid leaving the activity running without an associated desktop process, which would otherwise result in a stuck or unresponsive UI. This matches the intended 1:1 relationship between the activity and the Wine desktop process and ensures that all associated resources are cleaned up when the desktop client exits. Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com> --- dlls/wineandroid.drv/device.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c index 0a7642d95ab..4ec48368901 100644 --- a/dlls/wineandroid.drv/device.c +++ b/dlls/wineandroid.drv/device.c @@ -72,6 +72,8 @@ static int log_flags; WINE_DEFAULT_DEBUG_CHANNEL(android); +static int desktop_client_fd = -1; + #ifndef SYNC_IOC_WAIT #define SYNC_IOC_WAIT _IOW('>', 0, __s32) #endif @@ -910,6 +912,8 @@ static int handle_ioctl_message( JNIEnv *env, int fd ) { pthread_mutex_lock( &dispatch_ioctl_lock ); status = ioctl_funcs[code]( env, buffer, ret, sizeof(buffer), &reply_size, &reply_fd ); + if (IOCTL_CREATE_DESKTOP_VIEW == code) // special case: desktop client + desktop_client_fd = fd; pthread_mutex_unlock( &dispatch_ioctl_lock ); } } @@ -949,6 +953,8 @@ static int looper_handle_client( int fd, int events, void *data ) { pALooper_removeFd( looper, fd ); close( fd ); + if (fd == desktop_client_fd) // our explorer process died + _exit(0); } break; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10569