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

Commit 495bdc71 authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "Increase lock scope to protect variables" into main am: 8b949276 am: e6afcf0d

parents f2240443 e6afcf0d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -366,14 +366,15 @@ status_t AudioEffect::command(uint32_t cmdCode,
        return mStatus;
    }

    std::unique_lock ul(mLock, std::defer_lock);
    if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) {
        ul.lock();
        if (mEnabled == (cmdCode == EFFECT_CMD_ENABLE)) {
            return NO_ERROR;
        }
        if (replySize == nullptr || *replySize != sizeof(status_t) || replyData == nullptr) {
            return BAD_VALUE;
        }
        mLock.lock();
    }

    std::vector<uint8_t> data;
@@ -398,7 +399,6 @@ status_t AudioEffect::command(uint32_t cmdCode,
        if (status == NO_ERROR) {
            mEnabled = (cmdCode == EFFECT_CMD_ENABLE);
        }
        mLock.unlock();
    }

    return status;