VirtualBox

Changeset 81259 in vbox


Ignore:
Timestamp:
Oct 14, 2019 1:18:28 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard/Transfers: Bugfixes.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/SharedClipboard-win.h

    r81212 r81259  
    355355    /** Number of bytes already processed. */
    356356    uint64_t                       m_cbProcessed;
    357     /** Whether we already notified the parent of completion or not. */
    358     bool                           m_fNotifiedComplete;
     357    /** Whether this object already is in completed state or not. */
     358    bool                           m_fIsComplete;
    359359};
    360360
  • trunk/src/VBox/GuestHost/SharedClipboard/ClipboardDataObjectImpl-win.cpp

    r81223 r81259  
    649649    }
    650650
    651     if (FAILED(hr))
     651    if (   FAILED(hr)
     652        && hr != DV_E_FORMATETC) /* Can happen if the caller queries unknown / unhandled formats. */
     653    {
    652654        LogRel(("Shared Clipboard: Error returning data from data object (%Rhrc)\n", hr));
     655    }
    653656
    654657    LogFlowFunc(("hr=%Rhrc\n", hr));
  • trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp

    r81223 r81259  
    5555    , m_objInfo(*pObjInfo)
    5656    , m_cbProcessed(0)
    57     , m_fNotifiedComplete(false)
     57    , m_fIsComplete(false)
    5858{
    5959    AssertPtr(m_pTransfer);
     
    113113    if (lCount == 0)
    114114    {
    115         if (  !m_fNotifiedComplete
    116             && m_pParent)
    117         {
    118             m_pParent->OnTransferComplete();
    119         }
    120 
    121115        delete this;
    122116        return 0;
     
    173167        return STG_E_INVALIDPOINTER;
    174168
    175     if (nBytesToRead == 0)
     169    if (   nBytesToRead == 0
     170        || m_fIsComplete)
    176171    {
    177172        if (nBytesRead)
     
    212207        const uint64_t cbSize   = (uint64_t)m_objInfo.cbObject;
    213208        const uint32_t cbToRead = RT_MIN(cbSize - m_cbProcessed, nBytesToRead);
    214 
    215         bool fComplete = false;
    216209
    217210        if (RT_SUCCESS(rc))
     
    229222
    230223            /* Transfer complete? Make sure to close the object again. */
    231             fComplete = m_cbProcessed == cbSize;
    232 
    233             if (fComplete)
     224            m_fIsComplete = m_cbProcessed == cbSize;
     225
     226            if (m_fIsComplete)
    234227            {
    235228                if (m_pTransfer->ProviderIface.pfnObjClose)
     
    240233
    241234                if (m_pParent)
    242                 {
    243235                    m_pParent->OnTransferComplete();
    244                     m_fNotifiedComplete = true;
    245                 }
    246236            }
    247237        }
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp

    r81229 r81259  
    766766{
    767767    PSHCLOBJHANDLEINFO pIt;
    768     RTListForEach(&pTransfer->lstObj, pIt, SHCLOBJHANDLEINFO, Node)
     768    RTListForEach(&pTransfer->lstObj, pIt, SHCLOBJHANDLEINFO, Node) /** @todo Slooow ...but works for now. */
    769769    {
    770770        if (pIt->hObj == hObj)
     
    792792    int rc = VINF_SUCCESS;
    793793
     794    AssertMsgReturn(pTransfer->pszPathRootAbs, ("Transfer has no root path set\n"), VERR_INVALID_PARAMETER);
     795    AssertMsgReturn(pOpenCreateParms->pszPath, ("No path in open/create params set\n"), VERR_INVALID_PARAMETER);
     796
    794797    LogFlowFunc(("pszPath=%s, fCreate=0x%x\n", pOpenCreateParms->pszPath, pOpenCreateParms->fCreate));
    795798
     
    797800    {
    798801        PSHCLOBJHANDLEINFO pInfo
    799             = (PSHCLOBJHANDLEINFO)RTMemAlloc(sizeof(SHCLOBJHANDLEINFO));
     802            = (PSHCLOBJHANDLEINFO)RTMemAllocZ(sizeof(SHCLOBJHANDLEINFO));
    800803        if (pInfo)
    801804        {
     
    811814                if (RT_SUCCESS(rc))
    812815                {
    813                     char *pszPathAbs = RTStrAPrintf2("%s/%s", pTransfer->pszPathRootAbs, pOpenCreateParms->pszPath);
    814                     if (pszPathAbs)
     816                    pInfo->pszPathLocalAbs = RTStrAPrintf2("%s/%s", pTransfer->pszPathRootAbs, pOpenCreateParms->pszPath);
     817                    if (pInfo->pszPathLocalAbs)
    815818                    {
    816                         LogFlowFunc(("%s\n", pszPathAbs));
    817 
    818                         rc = RTFileOpen(&pInfo->u.Local.hFile, pszPathAbs, fOpen);
    819                         RTStrFree(pszPathAbs);
     819                        rc = RTFileOpen(&pInfo->u.Local.hFile, pInfo->pszPathLocalAbs, fOpen);
     820                        if (RT_SUCCESS(rc))
     821                        {
     822                            LogRel2(("Shared Clipboard: Opened file '%s'\n", pInfo->pszPathLocalAbs));
     823                        }
     824                        else
     825                            LogRel(("Shared Clipboard: Error opening file '%s', rc=%Rrc\n", pInfo->pszPathLocalAbs, rc));
    820826                    }
    821827                    else
     
    910916
    911917            RTListNodeRemove(&pInfo->Node);
     918
     919            ShClTransferObjHandleInfoDestroy(pInfo);
    912920
    913921            RTMemFree(pInfo);
     
    28632871
    28642872/**
    2865  * Converts Shared Clipboard create flags (see SharedClipboard-uri.) into IPRT create flags.
     2873 * Converts Shared Clipboard create flags (see SharedClipboard-transfers.h) into IPRT create flags.
    28662874 *
    28672875 * @returns IPRT status code.
    2868  * @param  fWritable            Whether the shared folder is writable
     2876 * @param  fWritable            Whether the object is writable.
    28692877 * @param  fShClFlags           Shared clipboard create flags.
    28702878 * @param  fMode                File attributes.
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp

    r81229 r81259  
    21402140            {
    21412141                LogRel2(("Shared Clipboard: Reported status %s (rc=%Rrc) of transfer %RU32 to guest\n",
    2142                          ShClGuestMsgToStr(uStatus), rcTransfer, pTransfer->State.uID));
     2142                         ShClTransferStatusToStr(uStatus), rcTransfer, pTransfer->State.uID));
    21432143
    21442144                if (puEvent)
     
    22692269                                        else
    22702270                                            LogRel(("Shared Clipboard: Guest reported status %s (error %Rrc) while starting transfer %RU32\n",
    2271                                                     ShClGuestMsgToStr(pReply->u.TransferStatus.uStatus),
     2271                                                    ShClTransferStatusToStr(pReply->u.TransferStatus.uStatus),
    22722272                                                    pReply->rc, pTransfer->State.uID));
    22732273                                    }
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