Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify event pipe before releasing NativeActivity resources #134

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ndk-glue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ unsafe extern "C" fn on_window_destroyed(
activity: *mut ANativeActivity,
_window: *mut ANativeWindow,
) {
*NATIVE_WINDOW.write().unwrap() = None;
wake(activity, Event::WindowDestroyed);
*NATIVE_WINDOW.write().unwrap() = None;
}

unsafe extern "C" fn on_input_queue_created(
Expand All @@ -279,10 +279,12 @@ unsafe extern "C" fn on_input_queue_destroyed(
activity: *mut ANativeActivity,
queue: *mut AInputQueue,
) {
wake(activity, Event::InputQueueDestroyed);
let mut input_queue_guard = INPUT_QUEUE.write().unwrap();
assert_eq!(input_queue_guard.as_ref().unwrap().ptr().as_ptr(), queue);
let input_queue = InputQueue::from_ptr(NonNull::new(queue).unwrap());
input_queue.detach_looper();
*INPUT_QUEUE.write().unwrap() = None;
wake(activity, Event::InputQueueDestroyed);
*input_queue_guard = None;
}

unsafe extern "C" fn on_content_rect_changed(activity: *mut ANativeActivity, rect: *const ARect) {
Expand Down