VirtualBox

Changeset 61334 in vbox


Ignore:
Timestamp:
May 31, 2016 2:04:04 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
107629
Message:

Audio: Fixed shutdown crashes.

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

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

    r61332 r61334  
    20642064        if (pDrv->Out.pStream)
    20652065        {
     2066            pDrv->pConnector->pfnStreamRelease(pDrv->pConnector, pDrv->Out.pStream);
     2067
    20662068            int rc3 = pDrv->pConnector->pfnStreamDestroy(pDrv->pConnector, pDrv->Out.pStream);
    20672069            AssertRC(rc3);
     
    20712073
    20722074        int rc2 = pDrv->pConnector->pfnStreamCreate(pDrv->pConnector, &CfgHost, pCfg, &pDrv->Out.pStream);
     2075        if (RT_SUCCESS(rc2))
     2076            pDrv->pConnector->pfnStreamAddRef(pDrv->pConnector, pDrv->Out.pStream);
     2077
    20732078        LogFlowFunc(("LUN#%RU8: Created output \"%s\", rc=%Rrc\n", pDrv->uLUN, pCfg->szName, rc2));
    20742079
     
    20902095        if (pDrv->Out.pStream)
    20912096        {
     2097            pDrv->pConnector->pfnStreamRelease(pDrv->pConnector, pDrv->Out.pStream);
     2098
    20922099            pDrv->pConnector->pfnStreamDestroy(pDrv->pConnector, pDrv->Out.pStream);
    20932100            pDrv->Out.pStream = NULL;
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r61332 r61334  
    154154                               ? pStream
    155155                               : pStream->pPair;
    156     AssertPtr(pStreamHst);
    157156    return pStreamHst;
    158157}
     
    339338        return VINF_SUCCESS;
    340339
    341     AssertPtr(pThis->pHostDrvAudio);
    342340    AssertMsg(pHstStream->enmCtx == PDMAUDIOSTREAMCTX_HOST,
    343341              ("Stream '%s' is not a host stream and therefore has no backend\n", pHstStream->szName));
     
    355353            if (!(pHstStream->fStatus & PDMAUDIOSTRMSTS_FLAG_ENABLED))
    356354            {
    357                 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_ENABLE);
     355                if (pThis->pHostDrvAudio)
     356                    rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_ENABLE);
    358357                if (RT_SUCCESS(rc))
    359358                    pHstStream->fStatus |= PDMAUDIOSTRMSTS_FLAG_ENABLED;
     
    380379            if (pHstStream->fStatus & PDMAUDIOSTRMSTS_FLAG_ENABLED)
    381380            {
    382                 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_DISABLE);
     381                if (pThis->pHostDrvAudio)
     382                    rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_DISABLE);
    383383                if (RT_SUCCESS(rc))
    384384                {
     
    405405            if (!(pHstStream->fStatus & PDMAUDIOSTRMSTS_FLAG_PAUSED))
    406406            {
    407                 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_PAUSE);
     407                if (pThis->pHostDrvAudio)
     408                    rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_PAUSE);
    408409                if (RT_SUCCESS(rc))
    409410                    pHstStream->fStatus |= PDMAUDIOSTRMSTS_FLAG_PAUSED;
     
    416417            if (pHstStream->fStatus & PDMAUDIOSTRMSTS_FLAG_PAUSED)
    417418            {
    418                 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_RESUME);
     419                if (pThis->pHostDrvAudio)
     420                    rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pHstStream, PDMAUDIOSTREAMCMD_RESUME);
    419421                if (RT_SUCCESS(rc))
    420422                    pHstStream->fStatus &= ~PDMAUDIOSTRMSTS_FLAG_PAUSED;
     
    19171919    LogFlowFunc(("%s: cRefs=%RU32\n", pStream->szName, pStream->cRefs));
    19181920
     1921    /* Try to find out which stream is which -- both streams could be destroyed (NULL)
     1922     * already, so do some additional checking here. */
    19191923    PPDMAUDIOSTREAM pHstStream = drvAudioGetHostStream(pStream);
    1920     PPDMAUDIOSTREAM pGstStream = pHstStream->pPair;
     1924    PPDMAUDIOSTREAM pGstStream = pHstStream ? pHstStream->pPair : pStream;
    19211925
    19221926    if (   (   pHstStream
     
    19291933    }
    19301934
    1931     int rc = drvAudioStreamControlInternal(pThis, pGstStream, PDMAUDIOSTREAMCMD_DISABLE);
    1932     if (   RT_SUCCESS(rc)
    1933         && pThis->pHostDrvAudio)
    1934     {
     1935    int rc = VINF_SUCCESS;
     1936
     1937    if (pGstStream)
     1938    {
     1939        AssertMsg(pGstStream->enmCtx == PDMAUDIOSTREAMCTX_GUEST,
     1940                  ("Stream '%s' is not a guest stream\n", pGstStream->szName));
     1941
     1942        rc = drvAudioStreamControlInternal(pThis, pGstStream, PDMAUDIOSTREAMCMD_DISABLE);
     1943    }
     1944
     1945    if (RT_SUCCESS(rc))
    19351946        rc = drvAudioStreamControlInternalBackend(pThis, pHstStream, PDMAUDIOSTREAMCMD_DISABLE);
    1936     }
    19371947
    19381948    if (RT_SUCCESS(rc))
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