VirtualBox

Ignore:
Timestamp:
Mar 18, 2013 2:09:03 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84336
Message:

Review of PDM driver destructors making sure that variables they use are correctly initialized in the constructor. Found several RTFileClose(0) cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r44528 r45061  
    10701070
    10711071    /* Empty the send queue */
    1072     RTSemEventDestroy(pThis->SendSem);
    1073     pThis->SendSem = NIL_RTSEMEVENT;
     1072    if (pThis->SendSem != NIL_RTSEMEVENT)
     1073    {
     1074        RTSemEventDestroy(pThis->SendSem);
     1075        pThis->SendSem = NIL_RTSEMEVENT;
     1076    }
    10741077
    10751078    int rc;
     
    10921095    }
    10931096# endif
    1094     rc = RTFileClose(pThis->hDeviceFile); AssertRC(rc);
    1095     pThis->hDeviceFile = NIL_RTFILE;
     1097    if (pThis->hDeviceFile != NIL_RTFILE)
     1098    {
     1099        rc = RTFileClose(pThis->hDeviceFile); AssertRC(rc);
     1100        pThis->hDeviceFile = NIL_RTFILE;
     1101    }
    10961102
    10971103#elif defined(RT_OS_WINDOWS)
     
    11361142    pThis->hDeviceFile = INVALID_HANDLE_VALUE;
    11371143#endif
     1144    pThis->SendSem     = NIL_RTSEMEVENT;
    11381145    /* IBase. */
    11391146    pDrvIns->IBase.pfnQueryInterface        = drvHostSerialQueryInterface;
     
    11431150    pThis->ICharConnector.pfnSetModemLines  = drvHostSerialSetModemLines;
    11441151    pThis->ICharConnector.pfnSetBreak       = drvHostSerialSetBreak;
    1145 
    1146 /** @todo Initialize all members with NIL values!! The destructor is ALWAYS called. */
    11471152
    11481153    /*
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