VirtualBox

Changeset 15157 in vbox


Ignore:
Timestamp:
Dec 9, 2008 11:39:21 AM (16 years ago)
Author:
vboxsync
Message:

Main: #3312: Fixed a wrong assertion in USBController triggered on a failure to revert to the current snapshot (hidden regression after rewriting USB support for Windows)

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r15140 r15157  
    588588        /* commit all changes made during loading the settings file */
    589589        commit();
    590 
    591         /* VirtualBox will not call trySetRegistered(), so
    592          * inform the USB proxy about all attached USB filters */
    593         mUSBController->onMachineRegistered (TRUE);
    594590    }
    595591    else
     
    41514147    mData->mRegistered = aRegistered;
    41524148
    4153     /* inform the USB proxy about all attached/detached USB filters */
    4154     mUSBController->onMachineRegistered (aRegistered);
    4155 
    41564149    return S_OK;
    41574150}
     
    72677260
    72687261/**
    7269  *  Discards all changes to machine settings.
    7270  *
    7271  *  @param  aNotify whether to notify the direct session about changes or not
    7272  *
    7273  *  @note Locks objects!
     7262 * Discards all changes to machine settings.
     7263 *
     7264 * @param aNotify   Whether to notify the direct session about changes or not.
     7265 *
     7266 * @note Locks objects for writing!
    72747267 */
    72757268void Machine::rollback (bool aNotify)
     
    74537446
    74547447/**
    7455  *  Copies all the hardware data from the given machine.
    7456  *
    7457  *  @note
    7458  *      This method must be called from under this object's lock.
    7459  *  @note
    7460  *      This method doesn't call #commit(), so all data remains backed up
    7461  *      and unsaved.
     7448 * Copies all the hardware data from the given machine.
     7449 *
     7450 * Currently, only called when the VM is being restored from a snapshot. In
     7451 * particular, this implies that the VM is not running during this method's
     7452 * call.
     7453 *
     7454 * @note This method must be called from under this object's lock.
     7455 *
     7456 * @note This method doesn't call #commit(), so all data remains backed up and
     7457 *       unsaved.
    74627458 */
    74637459void Machine::copyFrom (Machine *aThat)
    74647460{
    7465     AssertReturn (mType == IsMachine || mType == IsSessionMachine, (void) 0);
    7466     AssertReturn (aThat->mType == IsSnapshotMachine, (void) 0);
     7461    AssertReturnVoid (mType == IsMachine || mType == IsSessionMachine);
     7462    AssertReturnVoid (aThat->mType == IsSnapshotMachine);
     7463
     7464    AssertReturnVoid (mData->mMachineState < MachineState_Running ||
     7465                      mData->mMachineState >= MachineState_Discarding);
    74677466
    74687467    mHWData.assignCopy (aThat->mHWData);
     
    1016810167            {
    1016910168                /// @todo for now, we ignore errors since we've already
    10170                 /// and therefore cannot fail. Later, we may want to report a
    10171                 /// warning through the Progress object
     10169                /// discarded and therefore cannot fail. Later, we may want to
     10170                /// report a warning through the Progress object
    1017210171                HRESULT rc2 = (*it)->deleteStorageAndWait();
    1017310172                if (SUCCEEDED (rc2))
  • trunk/src/VBox/Main/USBControllerImpl.cpp

    r15051 r15157  
    9090    return S_OK;
    9191}
    92 
    9392
    9493/**
     
    418417{
    419418#ifdef VBOX_WITH_USB
     419
    420420    CheckComArgNotNull(aFilter);
    421421
     
    455455    filter->mInList = true;
    456456
    457     /// @todo After rewriting Win32 USB support, no more necessary;
    458     //  a candidate for removal.
    459 #if 0
    460     /* notify the proxy (only when the filter is active) */
    461     if (filter->data().mActive)
    462 #else
    463457    /* notify the proxy (only when it makes sense) */
    464458    if (filter->data().mActive && adep.machineState() >= MachineState_Running)
    465 #endif
    466459    {
    467460        USBProxyService *service = mParent->virtualBox()->host()->usbProxyService();
     
    473466
    474467    return S_OK;
    475 #else
     468
     469#else /* VBOX_WITH_USB */
     470
    476471    ReturnComNotImplemented();
    477 #endif
     472
     473#endif /* VBOX_WITH_USB */
    478474}
    479475
     
    482478{
    483479#ifdef VBOX_WITH_USB
     480
    484481    CheckComArgOutPointerValid(aFilter);
    485482
     
    522519    filter.queryInterfaceTo (aFilter);
    523520
    524     /// @todo After rewriting Win32 USB support, no more necessary;
    525     //  a candidate for removal.
    526 #if 0
    527     /* notify the proxy (only when the filter is active) */
    528     if (filter->data().mActive)
    529 #else
    530521    /* notify the proxy (only when it makes sense) */
    531522    if (filter->data().mActive && adep.machineState() >= MachineState_Running)
    532 #endif
    533523    {
    534524        USBProxyService *service = mParent->virtualBox()->host()->usbProxyService();
     
    541531
    542532    return S_OK;
    543 #else
     533
     534#else /* VBOX_WITH_USB */
     535
    544536    ReturnComNotImplemented();
    545 #endif
     537
     538#endif /* VBOX_WITH_USB */
    546539}
    547540
     
    837830
    838831#ifdef VBOX_WITH_USB
     832
    839833    if (mDeviceFilters.isBackedUp())
    840834    {
     
    850844                backedList->end())
    851845            {
    852     /// @todo After rewriting Win32 USB support, no more necessary;
    853     //  a candidate for removal.
    854 #if 0
    855                 /* notify the proxy (only when the filter is active) */
    856                 if ((*it)->data().mActive)
    857 #else
    858846                /* notify the proxy (only when it makes sense) */
    859847                if ((*it)->data().mActive &&
    860                     adep.machineState() >= MachineState_Running)
    861 #endif
     848                    adep.machineState() >= MachineState_Running &&
     849                    adep.machineState() < MachineState_Discarding)
    862850                {
    863851                    USBDeviceFilter *filter = *it;
     
    872860        }
    873861
    874     /// @todo After rewriting Win32 USB support, no more necessary;
    875     //  a candidate for removal.
    876 #if 0
    877 #else
    878         if (adep.machineState() >= MachineState_Running)
    879 #endif
     862        if (adep.machineState() >= MachineState_Running &&
     863            adep.machineState() < MachineState_Discarding)
    880864        {
    881865            /* find all removed old filters (absent in the new list)
     
    918902        ++ it;
    919903    }
     904
    920905#endif /* VBOX_WITH_USB */
    921906
     
    963948        {
    964949            AutoWriteLock peerlock (mPeer);
     950
    965951            /* commit all changes to new filters (this will reshare data with
    966952             * peers for those who have peers) */
     
    10441030    AssertComRCReturnVoid (thatCaller.rc());
    10451031
     1032    /* even more sanity */
     1033    Machine::AutoAnyStateDependency adep (mParent);
     1034    AssertComRCReturnVoid (adep.rc());
     1035    /* Machine::copyFrom() may not be called when the VM is running */
     1036    AssertReturnVoid (adep.machineState() < MachineState_Running ||
     1037                      adep.machineState() >= MachineState_Discarding);
     1038
    10461039    /* peer is not modified, lock it for reading (aThat is "master" so locked
    10471040     * first) */
    10481041    AutoMultiLock2 alock (aThat->rlock(), this->wlock());
    10491042
    1050     if (mParent->isRegistered())
    1051     {
    1052         /* reuse onMachineRegistered to tell USB proxy to remove all current
    1053            filters */
    1054         HRESULT rc = onMachineRegistered (FALSE);
    1055         AssertComRCReturn (rc, (void) 0);
    1056     }
    1057 
    10581043    /* this will back up current data */
    10591044    mData.assignCopy (aThat->mData);
    10601045
    10611046#ifdef VBOX_WITH_USB
     1047
     1048    /* Note that we won't inform the USB proxy about new filters since the VM is
     1049     * not running when we are here and therefore no need to do so */
     1050
    10621051    /* create private copies of all filters */
    10631052    mDeviceFilters.backup();
     
    10721061        mDeviceFilters->push_back (filter);
    10731062    }
     1063
    10741064#endif /* VBOX_WITH_USB */
    1075 
    1076     if (mParent->isRegistered())
    1077     {
    1078         /* reuse onMachineRegistered to tell USB proxy to insert all current
    1079            filters */
    1080         HRESULT rc = onMachineRegistered (TRUE);
    1081         AssertComRCReturn (rc, (void) 0);
    1082     }
    1083 }
    1084 
    1085 /**
    1086  *  Called by VirtualBox when it changes the registered state
    1087  *  of the machine this USB controller belongs to.
    1088  *
    1089  *  @param aRegistered  new registered state of the machine
    1090  *
    1091  *  @note Locks nothing.
    1092  */
    1093 HRESULT USBController::onMachineRegistered (BOOL aRegistered)
    1094 {
    1095     AutoCaller autoCaller (this);
    1096     AssertComRCReturnRC (autoCaller.rc());
    1097 
    1098     /// @todo After rewriting Win32 USB support, no more necessary;
    1099     //  a candidate for removal.
    1100 #if 0
    1101     notifyProxy (!!aRegistered);
    1102 #endif
    1103 
    1104     return S_OK;
    11051065}
    11061066
     
    11181078    AssertComRCReturnRC (autoCaller.rc());
    11191079
    1120     /// @todo After rewriting Win32 USB support, no more necessary;
    1121     //  a candidate for removal.
    1122 #if 0
    1123 #else
    11241080    /* we need the machine state */
    11251081    Machine::AutoAnyStateDependency adep (mParent);
     
    11291085    if (adep.machineState() < MachineState_Running)
    11301086        return S_OK;
    1131 #endif
    11321087
    11331088    /* we don't modify our data fields -- no need to lock */
  • trunk/src/VBox/Main/include/USBControllerImpl.h

    r15051 r15157  
    117117    void copyFrom (USBController *aThat);
    118118
    119     HRESULT onMachineRegistered (BOOL aRegistered);
    120 
    121119#ifdef VBOX_WITH_USB
    122120    HRESULT onDeviceFilterChange (USBDeviceFilter *aFilter,
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