VirtualBox

Changeset 12113 in vbox


Ignore:
Timestamp:
Sep 4, 2008 10:55:13 PM (16 years ago)
Author:
vboxsync
Message:

VirtualBox4: Killed some more USB assertions for when VBOX_WITH_USB isn't defined.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsUSB.cpp

    r11530 r12113  
    178178
    179179    CUSBController ctl = aMachine.GetUSBController();
    180     mGbUSB->setChecked (ctl.GetEnabled());
    181     mCbUSB2->setChecked (ctl.GetEnabledEhci());
     180    mGbUSB->setChecked (!ctl.isNull() && ctl.GetEnabled());
     181    mCbUSB2->setChecked (!ctl.isNull() && ctl.GetEnabledEhci());
    182182    usbAdapterToggled (mGbUSB->isChecked());
    183183
    184     CUSBDeviceFilterEnumerator en = ctl.GetDeviceFilters().Enumerate();
    185     while (en.HasMore())
    186         addUSBFilter (en.GetNext(), false /* isNew */);
     184    if (!ctl.isNull())
     185    {
     186        CUSBDeviceFilterEnumerator en = ctl.GetDeviceFilters().Enumerate();
     187        while (en.HasMore())
     188            addUSBFilter (en.GetNext(), false /* isNew */);
     189    }
    187190
    188191    mTwFilters->setCurrentItem (mTwFilters->topLevelItem (0));
     
    192195void VBoxVMSettingsUSB::putBackTo()
    193196{
    194     CUSBController ctl = mMachine.GetUSBController();
    195 
    196     ctl.SetEnabled (mGbUSB->isChecked());
    197     ctl.SetEnabledEhci (mCbUSB2->isChecked());
    198 
    199     if (mUSBFilterListModified)
    200     {
    201         /* First, remove all old filters */
    202         for (ulong count = ctl.GetDeviceFilters().GetCount(); count; -- count)
    203             ctl.RemoveDeviceFilter (0);
    204 
    205         /* Then add all new filters */
    206         for (int i = 0; i < mFilters.size(); ++ i)
    207         {
    208             CUSBDeviceFilter filter = mFilters [i];
    209             filter.SetActive (mTwFilters->topLevelItem (i)->
    210                 checkState (0) == Qt::Checked);
    211             ctl.InsertDeviceFilter (~0, filter);
    212         }
    213     }
    214 
     197    CUSBController ctl = mMachine.GetUSBController();
     198    if (!ctl.isNull())
     199    {
     200        ctl.SetEnabled (mGbUSB->isChecked());
     201        ctl.SetEnabledEhci (mCbUSB2->isChecked());
     202
     203        if (mUSBFilterListModified)
     204        {
     205            /* First, remove all old filters */
     206            for (ulong count = ctl.GetDeviceFilters().GetCount(); count; -- count)
     207                ctl.RemoveDeviceFilter (0);
     208
     209            /* Then add all new filters */
     210            for (int i = 0; i < mFilters.size(); ++ i)
     211            {
     212                CUSBDeviceFilter filter = mFilters [i];
     213                filter.SetActive (mTwFilters->topLevelItem (i)->
     214                    checkState (0) == Qt::Checked);
     215                ctl.InsertDeviceFilter (~0, filter);
     216            }
     217        }
     218    }
    215219    mUSBFilterListModified = false;
    216220}
     
    323327    else if (mType == MachineType)
    324328    {
    325         filter = mMachine.GetUSBController()
    326             .CreateDeviceFilter (mUSBFilterName.arg (maxFilterIndex + 1));
     329        CUSBController ctl = mMachine.GetUSBController();
     330        if (ctl.isNull())
     331            return;
     332        filter = ctl.CreateDeviceFilter (mUSBFilterName.arg (maxFilterIndex + 1));
    327333    }
    328334    else
     
    362368    else if (mType == MachineType)
    363369    {
    364         filter = mMachine.GetUSBController()
    365             .CreateDeviceFilter (vboxGlobal().details (usb));
     370        CUSBController ctl = mMachine.GetUSBController();
     371        if (ctl.isNull())
     372            return;
     373        filter = ctl.CreateDeviceFilter (vboxGlobal().details (usb));
    366374    }
    367375    else
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