VirtualBox

Changeset 55427 in vbox for trunk/src/VBox/Main/src-client


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

No more auto_ptr.

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

Legend:

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

    r55423 r55427  
    2727#include "AutoCaller.h"
    2828
    29 #include <memory>           /* For auto_ptr (deprecated) / unique_ptr, seee #7179. */
    30 
    3129#include <iprt/dir.h>
    3230#include <iprt/file.h>
     
    328326            pRecvCtx->mFormat   = aFormat;
    329327
    330             std::auto_ptr <RecvDataTask> pTask(new RecvDataTask(this, pRecvCtx));
     328            RecvDataTask *pTask = new RecvDataTask(this, pRecvCtx);
    331329            AssertReturn(pTask->isOk(), pTask->getRC());
    332330
    333331            rc = RTThreadCreate(NULL, GuestDnDSource::i_receiveDataThread,
    334                                 (void *)pTask.get(), 0, RTTHREADTYPE_MAIN_WORKER, 0, "dndSrcRcvData");
     332                                (void *)pTask, 0, RTTHREADTYPE_MAIN_WORKER, 0, "dndSrcRcvData");
    335333            if (RT_SUCCESS(rc))
    336334            {
     
    338336                ComAssertComRC(hr);
    339337
    340                 /* pTask is now owned by i_receiveDataThread(), so release it. */
    341                 pTask.release();
     338                /* Note: pTask is now owned by the worker thread. */
    342339            }
    343340            else if (pRecvCtx)
     
    700697    LogFlowFunc(("pvUser=%p\n", pvUser));
    701698
    702     std::auto_ptr<RecvDataTask> pTask(static_cast<RecvDataTask*>(pvUser));
    703     AssertPtr(pTask.get());
    704 
    705     const ComObjPtr<GuestDnDSource> pTarget(pTask->getSource());
    706     Assert(!pTarget.isNull());
    707 
    708     AutoCaller autoCaller(pTarget);
    709     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    710 
    711     int rc = pTarget->i_receiveData(pTask->getCtx());
    712     /* Nothing to do here anymore. */
    713 
    714     LogFlowFunc(("pSource=%p returning rc=%Rrc\n", (GuestDnDSource *)pTarget, rc));
     699    RecvDataTask *pTask = (RecvDataTask *)pvUser;
     700    AssertPtrReturn(pTask, VERR_INVALID_POINTER);
     701
     702    const ComObjPtr<GuestDnDSource> pSource(pTask->getSource());
     703    Assert(!pSource.isNull());
     704
     705    int rc;
     706
     707    AutoCaller autoCaller(pSource);
     708    if (SUCCEEDED(autoCaller.rc()))
     709    {
     710        rc = pSource->i_receiveData(pTask->getCtx());
     711        /* Nothing to do here anymore. */
     712    }
     713    else
     714         rc = VERR_COM_INVALID_OBJECT_STATE;
     715
     716    LogFlowFunc(("pSource=%p returning rc=%Rrc\n", (GuestDnDSource *)pSource, rc));
     717
     718    delete pTask;
    715719    return rc;
    716720}
  • 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