am 26f8ce83: Merge "To avoid the JNI memory leaks in video editor codes"

* commit '26f8ce83e04c4efd10c09bb83cfacdcd154d9450':
  To avoid the JNI memory leaks in video editor codes
This commit is contained in:
Jean-Baptiste Queru
2012-08-20 14:50:45 -07:00
committed by Android Git Automerger
3 changed files with 17 additions and 0 deletions

View File

@ -1853,6 +1853,9 @@ videoEditClasses_getEditSettings(
// Get the clip settings.
videoEditClasses_getClipSettings(pResult, pEnv, clipSettings,
&pSettings->pClipList[i]);
// Free the local references to avoid memory leaks
pEnv->DeleteLocalRef(clipSettings);
}
}
}
@ -1877,6 +1880,9 @@ videoEditClasses_getEditSettings(
// Get the transition settings.
videoEditClasses_getTransitionSettings(pResult, pEnv,
transitionSettings, &pSettings->pTransitionList[i]);
// Free the local references to avoid memory leaks
pEnv->DeleteLocalRef(transitionSettings);
}
}
}
@ -1900,6 +1906,9 @@ videoEditClasses_getEditSettings(
// Get the effect settings.
videoEditClasses_getEffectSettings(pResult, pEnv, effectSettings,
&pSettings->Effects[i]);
// Free the local references to avoid memory leaks
pEnv->DeleteLocalRef(effectSettings);
}
}
}

View File

@ -387,6 +387,9 @@ videoEditJava_getString(
(*pLength) = length;
}
}
// Delete local references to avoid memory leaks
pEnv->DeleteLocalRef(string);
}
// Return the string.

View File

@ -380,6 +380,9 @@ getClipSetting(
pEnv->GetIntField(object,fid);
M4OSA_TRACE1_1("videoRotation = %d",
pSettings->ClipProperties.videoRotationDegrees);
// Free the local references to avoid memory leaks
pEnv->DeleteLocalRef(clazz);
}
static void jniPreviewProgressCallback (void* cookie, M4OSA_UInt32 msgType,
@ -1849,7 +1852,9 @@ videoEditor_populateSettings(
"not initialized");
if (needToBeLoaded) {
getClipSetting(pEnv,properties, pContext->pEditSettings->pClipList[i]);
pEnv->DeleteLocalRef(properties);
} else {
pEnv->DeleteLocalRef(properties);
goto videoEditor_populateSettings_cleanup;
}
}