pub fn native_window() -> Option<LockReadGuard<NativeWindow>>
Expand description

Returns a NativeWindow held inside a lock, preventing Android from freeing it immediately in its NativeWindow destructor.

If the window is in use by e.g. a graphics API, make sure to hold on to this lock.

After receiving Event::WindowDestroyed ndk-glue will block in Android’s NativeWindow destructor callback until the lock is released, returning to Android and allowing it to free the window.

Warning

This function accesses a static variable internally and must only be used if you are sure there is exactly one version of ndk_glue in your dependency tree.