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.
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);
|
||||
int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi);
|
||||
|
||||
*ddpi = (float)nativeDdpi;
|
||||
*xdpi = nativeXdpi;
|
||||
*ydpi = nativeYdpi;
|
||||
|
||||
(*env)->DeleteLocalRef(env, jDisplayObj);
|
||||
(*env)->DeleteLocalRef(env, jDisplayClass);
|
||||
|
||||
if (ddpi) {
|
||||
*ddpi = (float)nativeDdpi;
|
||||
}
|
||||
if (xdpi) {
|
||||
*xdpi = nativeXdpi;
|
||||
}
|
||||
if (ydpi) {
|
||||
*ydpi = nativeYdpi;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue