VirtualBox

Changeset 3033 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Jun 4, 2007 3:40:28 PM (18 years ago)
Author:
vboxsync
Message:

Main: Made Auto[Limited]Caller support NULL objects (for conditional management).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r2981 r3033  
    456456         *  Increases the number of callers of the given object
    457457         *  by calling VirtualBoxBase::addCaller().
     458         *
     459         *  @param aObj     Object to add a caller to. If NULL, this
     460         *                  instance is effectively turned to no-op (where
     461         *                  rc() will return S_OK and state() will be
     462         *                  NotReady).
    458463         */
    459         AutoCallerBase (VirtualBoxBaseNEXT_base *aObj) : mObj (aObj)
     464        AutoCallerBase (VirtualBoxBaseNEXT_base *aObj)
     465            : mObj (aObj)
     466            , mRC (S_OK)
     467            , mState (NotReady)
    460468        {
    461             Assert (aObj);
    462             mRC = mObj->addCaller (&mState, aLimited);
     469            if (mObj)
     470                mRC = mObj->addCaller (&mState, aLimited);
    463471        }
    464472
     
    470478        ~AutoCallerBase()
    471479        {
    472             if (SUCCEEDED (mRC))
     480            if (mObj && SUCCEEDED (mRC))
    473481                mObj->releaseCaller();
    474482        }
     
    503511            if (SUCCEEDED (mRC))
    504512            {
    505                 mObj->releaseCaller();
     513                if (mObj)
     514                    mObj->releaseCaller();
    506515                mRC = E_FAIL;
    507516            }
     
    515524        {
    516525            Assert (!SUCCEEDED (mRC));
    517             if (!SUCCEEDED (mRC))
     526            if (mObj && !SUCCEEDED (mRC))
    518527                mRC = mObj->addCaller (&mState, aLimited);
    519528        }
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