VirtualBox

Ignore:
Timestamp:
Apr 24, 2015 2:49:11 PM (10 years ago)
Author:
vboxsync
Message:

No more auto_ptr.

File:
1 edited

Legend:

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

    r55426 r55427  
    2828
    2929#include <algorithm>        /* For std::find(). */
    30 #include <memory>           /* For auto_ptr (deprecated) / unique_ptr, seee #7179. */
    3130
    3231#include <iprt/file.h>
     
    485484    LogFlowFunc(("pvUser=%p\n", pvUser));
    486485
    487     std::auto_ptr<SendDataTask> pTask(static_cast<SendDataTask*>(pvUser));
    488     AssertPtr(pTask.get());
     486    SendDataTask *pTask = (SendDataTask *)pvUser;
     487    AssertPtrReturn(pTask, VERR_INVALID_POINTER);
    489488
    490489    const ComObjPtr<GuestDnDTarget> pTarget(pTask->getTarget());
    491490    Assert(!pTarget.isNull());
    492491
     492    int rc;
     493
    493494    AutoCaller autoCaller(pTarget);
    494     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    495 
    496     int rc = pTarget->i_sendData(pTask->getCtx());
    497     /* Nothing to do here anymore. */
     495    if (SUCCEEDED(autoCaller.rc()))
     496    {
     497        rc = pTarget->i_sendData(pTask->getCtx());
     498        /* Nothing to do here anymore. */
     499    }
     500    else
     501         rc = VERR_COM_INVALID_OBJECT_STATE;
    498502
    499503    LogFlowFunc(("pTarget=%p returning rc=%Rrc\n", (GuestDnDTarget *)pTarget, rc));
     504
     505    delete pTask;
    500506    return rc;
    501507}
     
    544550            pSendCtx->mData     = aData;
    545551
    546             std::auto_ptr<SendDataTask> pTask(new SendDataTask(this, pSendCtx));
     552            SendDataTask *pTask = new SendDataTask(this, pSendCtx);
    547553            AssertReturn(pTask->isOk(), pTask->getRC());
    548554
    549555            vrc = RTThreadCreate(NULL, GuestDnDTarget::i_sendDataThread,
    550                                  (void *)pTask.get(), 0, RTTHREADTYPE_MAIN_WORKER, 0, "dndTgtSndData");
     556                                 (void *)pTask, 0, RTTHREADTYPE_MAIN_WORKER, 0, "dndTgtSndData");
    551557            if (RT_SUCCESS(vrc))
    552558            {
     
    554560                ComAssertComRC(hr);
    555561
    556                 /* pTask is now owned by i_sendDataThread(), so release it. */
    557                 pTask.release();
     562                /* Note: pTask is now owned by the worker thread. */
    558563            }
    559564            else if (pSendCtx)
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