A branch in MilesAudioManager::killAudioEventImmediately can never enter.
AR_Play handle check is always false
For AR_Play requests, m_handleToInteractOn is initialised to AHSV_Error (0) in the AudioRequest constructor and is never written for play requests, so req->m_handleToInteractOn == audioEvent can never be true. The PR correctly updated isCurrentlyPlaying to use req->m_pendingEvent->getPlayingHandle() == handle, but killAudioEventImmediately was not updated correspondingly. As a result, a deferred restart request created by startNextLoop (or any other pending play request) will never be cancelled by killAudioEventImmediately, so the sound can start playing again even after an explicit kill call.
Greptile fix suggestion:
if( req->m_request == AR_Play && req->m_pendingEvent && req->m_pendingEvent->getPlayingHandle() == audioEvent )
//-------------------------------------------------------------------------------------------------
void MilesAudioManager::killAudioEventImmediately( AudioHandle audioEvent )
{
//First look for it in the request list.
transferDeferredAudioRequests();
std::list<AudioRequest*>::iterator ait;
for( ait = m_audioRequests.begin(); ait != m_audioRequests.end(); ait++ )
{
AudioRequest *req = (*ait);
if( req->m_request == AR_Play && req->m_handleToInteractOn == audioEvent ) // <--- this condition will never be true
{
deleteInstance(req);
ait = m_audioRequests.erase(ait);
return;
}
}
A branch in MilesAudioManager::killAudioEventImmediately can never enter.
AR_Playhandle check is always falseFor
AR_Playrequests,m_handleToInteractOnis initialised toAHSV_Error(0) in theAudioRequestconstructor and is never written for play requests, soreq->m_handleToInteractOn == audioEventcan never be true. The PR correctly updatedisCurrentlyPlayingto usereq->m_pendingEvent->getPlayingHandle() == handle, butkillAudioEventImmediatelywas not updated correspondingly. As a result, a deferred restart request created bystartNextLoop(or any other pending play request) will never be cancelled bykillAudioEventImmediately, so the sound can start playing again even after an explicit kill call.Greptile fix suggestion: