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

Commit 9b030df5 authored by Ricardo Garcia's avatar Ricardo Garcia Committed by Eric Laurent
Browse files

Fix for Visualizer release bug

Setting callback reference to NULL before requesting exit.

bug: 21804802
Change-Id: I54323959686880f4e7a10b766850f8c86c06edb6
parent 3fc792fe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ public:

    // install a callback to receive periodic captures. The capture rate is specified in milliHertz
    // and the capture format is according to flags  (see callback_flags).
    status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate);
    status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate,
                                bool force = false);

    // set the capture size capture size must be a power of two in the range
    // [VISUALIZER_CAPTURE_SIZE_MAX. VISUALIZER_CAPTURE_SIZE_MIN]
+4 −8
Original line number Diff line number Diff line
@@ -54,12 +54,8 @@ Visualizer::Visualizer (const String16& opPackageName,
Visualizer::~Visualizer()
{
    ALOGV("Visualizer::~Visualizer()");
    if (mCaptureThread != NULL) {
        mCaptureThread->requestExitAndWait();
        mCaptureThread.clear();
    }
    mCaptureCallBack = NULL;
    mCaptureFlags = 0;
    setEnabled(false);
    setCaptureCallBack(NULL, NULL, 0, 0, true);
}

status_t Visualizer::setEnabled(bool enabled)
@@ -99,14 +95,14 @@ status_t Visualizer::setEnabled(bool enabled)
}

status_t Visualizer::setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags,
        uint32_t rate)
        uint32_t rate, bool force)
{
    if (rate > CAPTURE_RATE_MAX) {
        return BAD_VALUE;
    }
    Mutex::Autolock _l(mCaptureLock);

    if (mEnabled) {
    if (force || mEnabled) {
        return INVALID_OPERATION;
    }