From 266c10e38c45326bfa21e712594c9dc8a70ab6ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 20 Jan 2015 14:25:26 -0500 Subject: [PATCH] lib/android: pin the App instance being registered in C MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/android/native_app_glue.nit | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/android/native_app_glue.nit b/lib/android/native_app_glue.nit index fc5a19f..af3c797 100644 --- a/lib/android/native_app_glue.nit +++ b/lib/android/native_app_glue.nit @@ -301,7 +301,10 @@ extern class NativeAppGlue `{ struct android_app* `} # We use the `userData` field of the C structure to store an handle to # the associated App private fun user_data: App `{ return recv->userData; `} - private fun user_data=(val: App) `{ recv->userData = val; `} + private fun user_data=(val: App) `{ + App_incr_ref(val); + recv->userData = val; + `} # Fill this in with the function to process input events. At this point # the event has already been pre-dispatched, and it will be finished upon -- 1.7.9.5