a/android: Early out of android_instance_base_cleanup if never init.

Fixes an assert on service exit on Android.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2392>
This commit is contained in:
Rylie Pavlik 2025-01-09 16:20:28 -06:00 committed by Marge Bot
parent e8389f8b48
commit aeb574c96c
2 changed files with 8 additions and 0 deletions

View file

@ -1 +1,4 @@
---
- mr.2392
---
Handle Android activity lifecycle. Handle Android activity lifecycle.

View file

@ -149,6 +149,11 @@ android_instance_base_init(struct android_instance_base *aib,
void void
android_instance_base_cleanup(struct android_instance_base *aib, struct xrt_instance *xinst) 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); assert(&(aib->base) == xinst->android_instance);
android_lifecycle_callbacks_destroy(&aib->lifecycle_callbacks); android_lifecycle_callbacks_destroy(&aib->lifecycle_callbacks);