Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b9f5be9 authored by ganxiaolin's avatar ganxiaolin
Browse files

Delete Visualizer before lpJniStorage



It is related to Change: Id17bea8a6ca7132042b9bfefed398a715c139be7
Fix ANR because of bug of Visualizer.
If lpJniStorage was delete first, callback_data_lock become a invalid value.
At mReceiver.periodicCapture() in CaptureThread, it will lock callback_data_lock.
Thus, CaptureThread will wait a invalid memory forever and visualizer wait CaptureThread exiting and causing ANR.

Signed-off-by: default avatarganxiaolin <ganxiaolin@xiaomi.com>
parent 4d14e9d4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -435,10 +435,13 @@ setup_failure:

// ----------------------------------------------------------------------------
static void android_media_visualizer_native_release(JNIEnv *env,  jobject thiz) {
    // ensure that lpVisualizer is deleted before lpJniStorage
    {
        sp<Visualizer> lpVisualizer = setVisualizer(env, thiz, 0);
        if (lpVisualizer == 0) {
            return;
        }
    }

    // delete the JNI data
    VisualizerJniStorage* lpJniStorage =