VirtualBox

Changeset 79294 in vbox


Ignore:
Timestamp:
Jun 23, 2019 4:09:31 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131503
Message:

Main/Guest::init: Better error and object status handling - DnD should *NOT* hide event source creation trouble!

File:
1 edited

Legend:

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

    r79055 r79294  
    8080    unconst(mParent) = aParent;
    8181
    82     /* Confirm a successful initialization when it's the case */
    83     autoInitSpan.setSucceeded();
    84 
    85     ULONG aMemoryBalloonSize;
     82    ULONG aMemoryBalloonSize = 0;
    8683    HRESULT hr = mParent->i_machine()->COMGETTER(MemoryBalloonSize)(&aMemoryBalloonSize);
    87     if (hr == S_OK) /** @todo r=andy SUCCEEDED? */
     84    if (SUCCEEDED(hr))
    8885        mMemoryBalloonSize = aMemoryBalloonSize;
    8986    else
    9087        mMemoryBalloonSize = 0; /* Default is no ballooning */
    9188
    92     BOOL fPageFusionEnabled;
     89    BOOL fPageFusionEnabled = FALSE;
    9390    hr = mParent->i_machine()->COMGETTER(PageFusionEnabled)(&fPageFusionEnabled);
    94     if (hr == S_OK) /** @todo r=andy SUCCEEDED? */
     91    if (SUCCEEDED(hr))
    9592        mfPageFusionEnabled = fPageFusionEnabled;
    9693    else
     
    113110    int vrc = RTTimerLRCreate(&mStatTimer, 1000 /* ms */,
    114111                              &Guest::i_staticUpdateStats, this);
    115     AssertMsgRC(vrc, ("Failed to create guest statistics update timer (%Rrc)\n", vrc));
     112    AssertMsgRC(vrc, ("Failed to create guest statistics update timer (%Rrc) - ignored\n", vrc));
    116113
    117114    hr = unconst(mEventSource).createObject();
     
    122119
    123120#ifdef VBOX_WITH_DRAG_AND_DROP
    124     try
    125     {
    126         GuestDnD::createInstance(this /* pGuest */);
    127         hr = unconst(mDnDSource).createObject();
    128         if (SUCCEEDED(hr))
    129             hr = mDnDSource->init(this /* pGuest */);
    130         if (SUCCEEDED(hr))
    131         {
    132             hr = unconst(mDnDTarget).createObject();
     121    if (SUCCEEDED(hr))
     122    {
     123        try
     124        {
     125            GuestDnD::createInstance(this /* pGuest */);
     126            hr = unconst(mDnDSource).createObject();
    133127            if (SUCCEEDED(hr))
    134                 hr = mDnDTarget->init(this /* pGuest */);
    135         }
    136 
    137         LogFlowFunc(("Drag and drop initializied with hr=%Rhrc\n", hr));
    138     }
    139     catch (std::bad_alloc &)
    140     {
    141         hr = E_OUTOFMEMORY;
     128                hr = mDnDSource->init(this /* pGuest */);
     129            if (SUCCEEDED(hr))
     130            {
     131                hr = unconst(mDnDTarget).createObject();
     132                if (SUCCEEDED(hr))
     133                    hr = mDnDTarget->init(this /* pGuest */);
     134            }
     135
     136            LogFlowFunc(("Drag and drop initializied with hr=%Rhrc\n", hr));
     137        }
     138        catch (std::bad_alloc &)
     139        {
     140            hr = E_OUTOFMEMORY;
     141        }
    142142    }
    143143#endif
     144
     145    /* Confirm a successful initialization when it's the case: */
     146    if (SUCCEEDED(hr))
     147        autoInitSpan.setSucceeded();
     148    else
     149        autoInitSpan.setFailed();
    144150
    145151    LogFlowFunc(("hr=%Rhrc\n", hr));
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette