jmpessoa / lazandroidmodulewizard

LAMW: Lazarus Android Module Wizard: Form Designer and Components development model!
250 stars 83 forks source link

Update to keep jni constantly updated [by ADiV] #449

Closed tr3esoftware closed 2 years ago

tr3esoftware commented 2 years ago

In order to always keep the references to gApp.jni.jEnv and gApp.jni.jThis updated, the variables FjEnv and FjThis have been eliminated to avoid an error that is occurring a lot in Google Play: Pure null pointer dereference. A variable that is assigned a value and eventually disappears is reused and native dereference fails.

https://source.android.com/devices/tech/debug/native-crash

These are the affected functions:

Init(gApp); to Init; Reinit(gApp); to Reinit; Show(gApp); to InitShowing; InitShowing(gApp); to InitShowing; ResetShowing(gApp); to ReinitShowing;

UpdateJNI disappears.

This way the code is also simplified and it is more efficient by not having to call UpdateJNI.