VirtualBox

Changeset 35034 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Dec 13, 2010 4:41:17 PM (14 years ago)
Author:
vboxsync
Message:

ConsoleImpl.h: Made the SafeVMPtr and SafeVMPtrQuiet safer by checking that the VM pointer isn't NULL after retriving it.

File:
1 edited

Legend:

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

    r34906 r35034  
    313313     *  @sa SafeVMPtr, SafeVMPtrQuiet
    314314     */
    315     typedef AutoVMCallerBase <false, false> AutoVMCaller;
     315    typedef AutoVMCallerBase<false, false> AutoVMCaller;
    316316
    317317    /**
     
    320320     *  @note Temporarily locks the argument for writing.
    321321     */
    322     typedef AutoVMCallerBase <true, false> AutoVMCallerQuiet;
     322    typedef AutoVMCallerBase<true, false> AutoVMCallerQuiet;
    323323
    324324    /**
     
    328328     *  @note Temporarily locks the argument for writing.
    329329     */
    330     typedef AutoVMCallerBase <false, true> AutoVMCallerWeak;
     330    typedef AutoVMCallerBase<false, true> AutoVMCallerWeak;
    331331
    332332    /**
     
    337337     *  @note Temporarily locks the argument for writing.
    338338     */
    339     typedef AutoVMCallerBase <true, true> AutoVMCallerQuietWeak;
     339    typedef AutoVMCallerBase<true, true> AutoVMCallerQuietWeak;
    340340
    341341    /**
    342342     *  Base template for SaveVMPtr and SaveVMPtrQuiet.
    343343     */
    344     template <bool taQuiet = false>
    345     class SafeVMPtrBase : public AutoVMCallerBase <taQuiet, true>
     344    template<bool taQuiet = false>
     345    class SafeVMPtrBase : public AutoVMCallerBase<taQuiet, true>
    346346    {
    347         typedef AutoVMCallerBase <taQuiet, true> Base;
     347        typedef AutoVMCallerBase<taQuiet, true> Base;
    348348    public:
    349349        SafeVMPtrBase(Console *aThat) : Base(aThat), mpVM(NULL)
    350350        {
    351351            if (SUCCEEDED(Base::mRC))
     352            {
    352353                mpVM = aThat->mpVM;
     354                if (!mpVM)
     355                    Base::mRC = E_FAIL; /** @todo use setError here. */
     356            }
    353357        }
    354358        /** Smart SaveVMPtr to PVM cast operator */
     
    381385     *  @sa SafeVMPtrQuiet, AutoVMCaller
    382386     */
    383     typedef SafeVMPtrBase <false> SafeVMPtr;
     387    typedef SafeVMPtrBase<false> SafeVMPtr;
    384388
    385389    /**
     
    398402     *  @sa SafeVMPtr, AutoVMCaller
    399403     */
    400     typedef SafeVMPtrBase <true> SafeVMPtrQuiet;
     404    typedef SafeVMPtrBase<true> SafeVMPtrQuiet;
    401405
    402406    class SharedFolderData
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