VirtualBox

Changeset 17887 in vbox for trunk/src


Ignore:
Timestamp:
Mar 15, 2009 3:27:21 PM (16 years ago)
Author:
vboxsync
Message:

dhcp settings fixes

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

Legend:

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

    r17881 r17887  
    4949    AssertReturn (autoInitSpan.isOk(), E_FAIL);
    5050
     51    /* share VirtualBox weakly (parent remains NULL so far) */
     52    unconst (mVirtualBox) = aVirtualBox;
     53
    5154    unconst(mName) = aName;
     55    m.IPAddress = "0.0.0.0";
     56    m.networkMask = "0.0.0.0";
     57    m.enabled = FALSE;
     58    m.FromIPAddress = "0.0.0.0";
     59    m.ToIPAddress = "0.0.0.0";
    5260
    5361    /* register with VirtualBox early, since uninit() will
     
    6876    AutoInitSpan autoInitSpan (this);
    6977    AssertReturn (autoInitSpan.isOk(), E_FAIL);
     78
     79    /* share VirtualBox weakly (parent remains NULL so far) */
     80    unconst (mVirtualBox) = aVirtualBox;
    7081
    7182    aVirtualBox->addDependentChild (this);
     
    99110    aNode.setValue <Bstr> ("IPAddress", m.IPAddress);
    100111    aNode.setValue <Bstr> ("networkMask", m.networkMask);
    101     if(!m.FromIPAddress.isNull())
    102         aNode.setValue <Bstr> ("FromIPAddress", m.FromIPAddress);
    103     if(!m.ToIPAddress.isNull())
    104         aNode.setValue <Bstr> ("ToIPAddress", m.ToIPAddress);
     112    aNode.setValue <Bstr> ("FromIPAddress", m.FromIPAddress);
     113    aNode.setValue <Bstr> ("ToIPAddress", m.ToIPAddress);
    105114
    106115    return S_OK;
     
    138147    CheckComRCReturnRC (autoCaller.rc());
    139148
     149    /* VirtualBox::saveSettings() needs a write lock */
     150    AutoMultiWriteLock2 alock (mVirtualBox, this);
     151
    140152    m.enabled = aEnabled;
    141153
    142     return S_OK;
    143 
     154    HRESULT rc = mVirtualBox->saveSettings();
     155
     156    return rc;
    144157}
    145158
     
    203216    AssertReturn (aToIPAddress != NULL, E_INVALIDARG);
    204217
     218    AutoCaller autoCaller (this);
     219    CheckComRCReturnRC (autoCaller.rc());
     220
     221    /* VirtualBox::saveSettings() needs a write lock */
     222    AutoMultiWriteLock2 alock (mVirtualBox, this);
     223
    205224    m.IPAddress = aIPAddress;
    206225    m.networkMask = aNetworkMask;
     
    208227    m.ToIPAddress = aToIPAddress;
    209228
    210     return S_OK;
    211 }
     229    HRESULT rc = mVirtualBox->saveSettings();
     230
     231    return rc;
     232}
  • trunk/src/VBox/Main/include/DhcpServerImpl.h

    r17881 r17887  
    7979
    8080private:
     81    /** weak VirtualBox parent */
     82    const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
     83
    8184    const Bstr mName;
    8285
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