VirtualBox

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


Ignore:
Timestamp:
Apr 30, 2015 2:27:39 PM (10 years ago)
Author:
vboxsync
Message:

DnD: Rollback handling, bugfixes, cleanup.

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

Legend:

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

    r55549 r55556  
    317317                 uStatus, uPercentage, rcOp));
    318318
    319     int vrc = VINF_SUCCESS;
     319    int rc = VINF_SUCCESS;
    320320    if (!m_progress.isNull())
    321321    {
     
    383383    }
    384384
    385     LogFlowFuncLeaveRC(vrc);
    386     return vrc;
     385    LogFlowFuncLeaveRC(rc);
     386    return rc;
    387387}
    388388
  • trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp

    r55549 r55556  
    593593        if (RT_SUCCESS(rc))
    594594        {
    595             /** @todo Unescpae path before printing. */
    596             LogRel2(("DnD: Transferring guest file to host: %s\n", pCtx->mURI.objURI.GetDestPath().c_str()));
    597 
    598595            /* Note: Protocol v1 does not send any file sizes, so always 0. */
    599596            if (mDataBase.mProtocolVersion >= 2)
    600597                rc = pCtx->mURI.objURI.SetSize(cbSize);
     598
     599            /** @todo Unescpae path before printing. */
     600            LogRel2(("DnD: Transferring guest file to host: %s (%RU64 bytes, mode 0x%x)\n",
     601                     pCtx->mURI.objURI.GetDestPath().c_str(), pCtx->mURI.objURI.GetSize(), pCtx->mURI.objURI.GetMode()));
     602
     603            /** @todo Set progress object title to current file being transferred? */
    601604
    602605            if (!cbSize) /* 0-byte file? Close again. */
     
    737740     * Reset any old data.
    738741     */
    739     pCtx->mData.vecData.clear();
    740     pCtx->mData.cbToProcess = 0;
    741     pCtx->mData.cbProcessed = 0;
    742 
    743     pResp->reset();
    744     pResp->resetProgress(m_pGuest);
     742    pCtx->mData.Reset();
     743    pCtx->mURI.Reset();
    745744
    746745    /* Set the format we are going to retrieve to have it around
    747746     * when retrieving the data later. */
     747    pResp->reset();
    748748    pResp->setFormat(pCtx->mFormat);
    749749
     
    876876        return VERR_INVALID_POINTER;
    877877
    878 #define REGISTER_CALLBACK(x) \
     878#define REGISTER_CALLBACK(x)                                    \
    879879    rc = pResp->setCallback(x, i_receiveURIDataCallback, pCtx); \
    880     if (RT_FAILURE(rc)) \
     880    if (RT_FAILURE(rc))                                         \
    881881        return rc;
    882882
    883 #define UNREGISTER_CALLBACK(x) \
    884     rc = pResp->setCallback(x, NULL); \
    885     AssertRC(rc);
     883#define UNREGISTER_CALLBACK(x)                                  \
     884    {                                                           \
     885        int rc2 = pResp->setCallback(x, NULL);                  \
     886        AssertRC(rc2);                                          \
     887    }
    886888
    887889    /*
     
    927929            rc = pCtx->mCallback.Wait(msTimeout);
    928930            LogFlowFunc(("URI callback done, rc=%Rrc\n", rc));
     931            if (RT_SUCCESS(rc))
     932            {
     933                rc = pCtx->mCallback.Result();
     934                LogFlowFunc(("Callback result is %Rrc\n", rc));
     935            }
    929936        }
    930937
     
    946953    if (RT_FAILURE(rc))
    947954    {
    948         LogFlowFunc(("Rolling back ...\n"));
    949 
    950         /* Rollback by removing any stuff created. */
    951         for (size_t i = 0; i < pCtx->mURI.lstFiles.size(); ++i)
    952             RTFileDelete(pCtx->mURI.lstFiles.at(i).c_str());
    953         for (size_t i = 0; i < pCtx->mURI.lstDirs.size(); ++i)
    954             RTDirRemove(pCtx->mURI.lstDirs.at(i).c_str());
    955     }
    956 
    957     /* Try removing (hopefully) empty drop directory in any case. */
    958     if (pCtx->mURI.strDropDir.isNotEmpty())
    959         RTDirRemove(pCtx->mURI.strDropDir.c_str());
     955        int rc2 = pCtx->mURI.Rollback(); /** @todo Inform user on rollback failure? */
     956        LogFlowFunc(("Rolling back ended with rc=%Rrc\n", rc2));
     957    }
    960958
    961959    LogFlowFuncLeaveRC(rc);
     
    11211119    }
    11221120
    1123     LogFlowFunc(("cbProcessed=%RU64, cbToProcess=%RU64, fNotify=%RTbool\n",
    1124                  pCtx->mData.cbProcessed, pCtx->mData.cbToProcess, fNotify));
     1121    LogFlowFunc(("cbProcessed=%RU64, cbToProcess=%RU64, fNotify=%RTbool, rc=%Rrc\n",
     1122                 pCtx->mData.cbProcessed, pCtx->mData.cbToProcess, fNotify, rc));
    11251123
    11261124    if (fNotify)
  • trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp

    r55549 r55556  
    737737                LogRel2(("DnD: Transferring host file to guest: %s (%RU64 bytes, mode 0x%x)\n",
    738738                         strPathSrc.c_str(), aFile.GetSize(), aFile.GetMode()));
     739
     740                /** @todo Set progress object title to current file being transferred? */
    739741            }
    740742            else
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