As far as I understand, ndk-glue's NativeActivity callbacks make it impossible or at least very hard to handle the NativeWindow lifecycle in a manner that conforms with the Android documentation. The chief offending callback is on_window_destroyed.
ANativeActivityCallbacks documentation seems to demand that NativeWindow cleanup code be executed in a synchronized manner, i.e. before the callback returns. For example, one might wish to ensure OpenGL is done drawing and destroy the associated EGLSurface.
NDK android_native_app_glue appears to follow this guideline, cf. especially how lifecycle event handling is split into pre-user-callback and post-user-callback parts (lines 89 and 146 respectively).
EDIT: for added context, compare example usage of NDK android_native_app_glue feature.
As far as I understand,
ndk-glue'sNativeActivitycallbacks make it impossible or at least very hard to handle theNativeWindowlifecycle in a manner that conforms with the Android documentation. The chief offending callback ison_window_destroyed.ANativeActivityCallbacksdocumentation seems to demand thatNativeWindowcleanup code be executed in a synchronized manner, i.e. before the callback returns. For example, one might wish to ensure OpenGL is done drawing and destroy the associatedEGLSurface.NDK
android_native_app_glueappears to follow this guideline, cf. especially how lifecycle event handling is split into pre-user-callback and post-user-callback parts (lines 89 and 146 respectively).EDIT: for added context, compare example usage of NDK
android_native_app_gluefeature.