summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorOscar Rydhé <oscar.rydhe@sonyericsson.com>2011-12-29 13:57:04 +0100
committerSteve Kondik <steve@cyngn.com>2015-11-07 05:40:42 -0800
commitecc58f4ef77bacabf8751b37a340439637666008 (patch)
tree6a52c9cc4037e7fe5c381777c9a506dac87c1197 /media/jni
parentebeb70d9d62782e82b1183ed2e1aa405da0294d7 (diff)
downloadframeworks_base-ecc58f4ef77bacabf8751b37a340439637666008.zip
frameworks_base-ecc58f4ef77bacabf8751b37a340439637666008.tar.gz
frameworks_base-ecc58f4ef77bacabf8751b37a340439637666008.tar.bz2
Stop thread before deleting object reference
If setPeriodicCapture is called Visualizer will start a thread and do periodic callbacks. When native_finalize is called the reference to the class is deleted. If a callback happens after this the reference is no longer valid and when used from the callback method the vm crashes. With this patch the thread will be terminated before deleting the reference. Please note that this change depends on the commit in platform/frameworks/av with the same Change-Id. Change-Id: I30f331437ddad05f8d52c244cdbecb1859a0abd2
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/audioeffect/android_media_Visualizer.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/media/jni/audioeffect/android_media_Visualizer.cpp b/media/jni/audioeffect/android_media_Visualizer.cpp
index 0557019..10df3ae 100644
--- a/media/jni/audioeffect/android_media_Visualizer.cpp
+++ b/media/jni/audioeffect/android_media_Visualizer.cpp
@@ -248,6 +248,7 @@ static sp<Visualizer> setVisualizer(JNIEnv* env, jobject thiz,
v->incStrong((void*)setVisualizer);
}
if (old != 0) {
+ old->cancelCaptureCallBack();
old->decStrong((void*)setVisualizer);
}
env->SetLongField(thiz, fields.fidNativeVisualizer, (jlong)v.get());