VirtualBox

Changeset 89412 in vbox


Ignore:
Timestamp:
May 31, 2021 8:14:47 PM (4 years ago)
Author:
vboxsync
Message:

DrvAudio: Fixed race condition in destructor: Must get the threads out of the way before cleaning up streams. bugref:9890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r89379 r89412  
    46154615
    46164616    /*
    4617      * Note: No calls here to the driver below us anymore,
    4618      *       as PDM already has destroyed it.
    4619      *       If you need to call something from the host driver,
    4620      *       do this in drvAudioPowerOff() instead.
    4621      */
    4622 
    4623     /* Thus, NULL the pointer to the host audio driver first,
    4624      * so that routines like drvAudioStreamDestroyInternal() don't call the driver(s) below us anymore. */
     4617     * We must start by setting pHostDrvAudio to NULL here as the anything below
     4618     * us has already been destroyed at this point.
     4619     */
    46254620    if (RTCritSectRwIsInitialized(&pThis->CritSectHotPlug))
    46264621    {
     
    46354630    }
    46364631
     4632    /*
     4633     * Make sure the thread pool is out of the picture before we terminate all the streams.
     4634     */
     4635    if (pThis->hReqPool != NIL_RTREQPOOL)
     4636    {
     4637        uint32_t cRefs = RTReqPoolRelease(pThis->hReqPool);
     4638        Assert(cRefs == 0); RT_NOREF(cRefs);
     4639        pThis->hReqPool = NIL_RTREQPOOL;
     4640    }
     4641
     4642    /*
     4643     * Destroy all streams.
     4644     */
    46374645    if (RTCritSectRwIsInitialized(&pThis->CritSectGlobals))
    46384646    {
     
    46684676    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->Stats.TotalBytesRead);
    46694677#endif
    4670 
    4671     if (pThis->hReqPool != NIL_RTREQPOOL)
    4672     {
    4673         uint32_t cRefs = RTReqPoolRelease(pThis->hReqPool);
    4674         Assert(cRefs == 0); RT_NOREF(cRefs);
    4675         pThis->hReqPool = NIL_RTREQPOOL;
    4676     }
    46774678
    46784679    LogFlowFuncLeave();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette