From aeb574c96c70727a9b5fef61f4694d04b7e4cb04 Mon Sep 17 00:00:00 2001 From: Rylie Pavlik Date: Thu, 9 Jan 2025 16:20:28 -0600 Subject: [PATCH] a/android: Early out of android_instance_base_cleanup if never init. Fixes an assert on service exit on Android. Part-of: --- doc/changes/misc_features/mr.1655.md | 3 +++ src/xrt/auxiliary/android/android_instance_base.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/doc/changes/misc_features/mr.1655.md b/doc/changes/misc_features/mr.1655.md index f9d0651fd..981a1df6e 100644 --- a/doc/changes/misc_features/mr.1655.md +++ b/doc/changes/misc_features/mr.1655.md @@ -1 +1,4 @@ +--- +- mr.2392 +--- Handle Android activity lifecycle. diff --git a/src/xrt/auxiliary/android/android_instance_base.c b/src/xrt/auxiliary/android/android_instance_base.c index 1de84514d..2e2bcd881 100644 --- a/src/xrt/auxiliary/android/android_instance_base.c +++ b/src/xrt/auxiliary/android/android_instance_base.c @@ -149,6 +149,11 @@ android_instance_base_init(struct android_instance_base *aib, void android_instance_base_cleanup(struct android_instance_base *aib, struct xrt_instance *xinst) { + if (xinst->android_instance == NULL) { + // Already cleaned up or never initialized. + return; + } + assert(&(aib->base) == xinst->android_instance); android_lifecycle_callbacks_destroy(&aib->lifecycle_callbacks);