mirror of https://github.com/encounter/SDL.git
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);
|
||||||
|
|
||||||
*ddpi = (float)nativeDdpi;
|
|
||||||
*xdpi = nativeXdpi;
|
(*env)->DeleteLocalRef(env, jDisplayObj);
|
||||||
*ydpi = nativeYdpi;
|
(*env)->DeleteLocalRef(env, jDisplayClass);
|
||||||
|
|
||||||
|
if (ddpi) {
|
||||||
|
*ddpi = (float)nativeDdpi;
|
||||||
|
}
|
||||||
|
if (xdpi) {
|
||||||
|
*xdpi = nativeXdpi;
|
||||||
|
}
|
||||||
|
if (ydpi) {
|
||||||
|
*ydpi = nativeYdpi;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue