mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fixed bug 3932 - Android, GetDisplayDPI release local reference
Sylvain When writing JNI code, one has to make sure all local references are released otherwise the app end up crashing.
This commit is contained in:
parent
a7d2d12c64
commit
9192c93e90
@ -1065,9 +1065,19 @@ int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi)
|
|||||||
float nativeYdpi = (*env)->GetFloatField(env, jDisplayObj, fidYdpi);
|
float nativeYdpi = (*env)->GetFloatField(env, jDisplayObj, fidYdpi);
|
||||||
int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi);
|
int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi);
|
||||||
|
|
||||||
|
|
||||||
|
(*env)->DeleteLocalRef(env, jDisplayObj);
|
||||||
|
(*env)->DeleteLocalRef(env, jDisplayClass);
|
||||||
|
|
||||||
|
if (ddpi) {
|
||||||
*ddpi = (float)nativeDdpi;
|
*ddpi = (float)nativeDdpi;
|
||||||
|
}
|
||||||
|
if (xdpi) {
|
||||||
*xdpi = nativeXdpi;
|
*xdpi = nativeXdpi;
|
||||||
|
}
|
||||||
|
if (ydpi) {
|
||||||
*ydpi = nativeYdpi;
|
*ydpi = nativeYdpi;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user