VirtualBox

Changeset 74759 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 11, 2018 11:24:47 AM (6 years ago)
Author:
vboxsync
Message:

Main/Progress: clean up error handling and eliminate useless throwing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/ProgressImpl.cpp

    r73853 r74759  
    168168    AssertReturn(autoInitSpan.isOk(), E_FAIL);
    169169
    170     HRESULT rc = S_OK;
    171     rc = unconst(pEventSource).createObject();
    172     if (FAILED(rc)) throw rc;
     170    HRESULT rc = unconst(pEventSource).createObject();
     171    if (FAILED(rc))
     172        return rc;
    173173
    174174    rc = pEventSource->init();
    175     if (FAILED(rc)) throw rc;
    176 
    177 //    rc = Progress::init(
    178 //#if !defined(VBOX_COM_INPROC)
    179 //                        aParent,
    180 //#endif
    181 //                         aInitiator, aDescription, FALSE, aId);
    182 // NA
     175    if (FAILED(rc))
     176        return rc;
     177
    183178#if !defined(VBOX_COM_INPROC)
    184179    AssertReturn(aParent, E_INVALIDARG);
     
    215210
    216211    unconst(mDescription) = aDescription;
    217 
    218 
    219 // end of assertion
    220 
    221 
    222     if (FAILED(rc)) return rc;
    223212
    224213    mCancelable = aCancelable;
     
    237226    RTSemEventMultiReset(mCompletedSem);
    238227
    239     /* Confirm a successful initialization when it's the case */
    240     if (SUCCEEDED(rc))
    241         autoInitSpan.setSucceeded();
    242 
    243     return rc;
     228    /* Confirm a successful initialization. */
     229    autoInitSpan.setSucceeded();
     230
     231    return S_OK;
    244232}
    245233
     
    268256    AutoInitSpan autoInitSpan(this);
    269257    AssertReturn(autoInitSpan.isOk(), E_FAIL);
    270 
    271     HRESULT rc = S_OK;
    272     /* Guarantees subclasses call this method at the proper time */
    273     NOREF(autoInitSpan);
    274 
    275     if (FAILED(rc)) return rc;
    276258
    277259    mCancelable = aCancelable;
     
    292274    RTSemEventMultiReset(mCompletedSem);
    293275
    294     /* Confirm a successful initialization when it's the case */
    295     if (SUCCEEDED(rc))
    296         autoInitSpan.setSucceeded();
    297 
    298     return rc;
     276    /* Confirm a successful initialization. */
     277    autoInitSpan.setSucceeded();
     278
     279    return S_OK;
    299280}
    300281
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