VirtualBox

Changeset 42867 in vbox for trunk


Ignore:
Timestamp:
Aug 17, 2012 2:06:26 PM (12 years ago)
Author:
vboxsync
Message:

GuestImpl: Check for bad_alloc (DnD), cleaning up guest sessions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestImpl.cpp

    r42864 r42867  
    104104    AssertMsgRC(vrc, ("Failed to create guest statistics update timer(%Rra)\n", vrc));
    105105
     106    try
     107    {
    106108#ifdef VBOX_WITH_DRAG_AND_DROP
    107     m_pGuestDnD = new GuestDnD(this);
     109        m_pGuestDnD = new GuestDnD(this);
     110        AssertPtr(m_pGuestDnD);
    108111#endif
     112    }
     113    catch(std::bad_alloc &)
     114    {
     115        return E_OUTOFMEMORY;
     116    }
    109117
    110118    return S_OK;
     
    130138    mMagic     = 0;
    131139
     140#ifdef VBOX_WITH_GUEST_CONTROL
     141    GuestSessions::iterator itSessions = mData.mGuestSessions.begin();
     142    while (itSessions != mData.mGuestSessions.end())
     143    {
     144        if (!itSessions->second.isNull())
     145            itSessions->second->uninit();
     146        itSessions++;
     147    }
     148    mData.mGuestSessions.clear();
     149#endif
     150
    132151#ifdef VBOX_WITH_DRAG_AND_DROP
    133     delete m_pGuestDnD;
    134     m_pGuestDnD = NULL;
     152    if (m_pGuestDnD)
     153    {
     154        delete m_pGuestDnD;
     155        m_pGuestDnD = NULL;
     156    }
    135157#endif
    136158
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