VirtualBox

Ignore:
Timestamp:
May 20, 2015 11:18:14 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100467
Message:

DnD: Fixed hang when reporting host errors such as inaccessible (locked) files.

File:
1 edited

Legend:

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

    r55640 r55963  
    177177}
    178178
    179 int GuestDnDCallbackEvent::Notify(int rc)
     179int GuestDnDCallbackEvent::Notify(int rc /* = VINF_SUCCESS */)
    180180{
    181181    mRc = rc;
     
    209209}
    210210
    211 /* static */
    212 Utf8Str GuestDnDResponse::errorToString(const ComObjPtr<Guest>& pGuest, int guestRc)
    213 {
    214     Utf8Str strError;
    215 
    216     switch (guestRc)
    217     {
    218         case VERR_ACCESS_DENIED:
    219             strError += Utf8StrFmt(pGuest->tr("For one or more guest files or directories selected for transferring to the host your guest "
    220                                               "user does not have the appropriate access rights for. Please make sure that all selected "
    221                                               "elements can be accessed and that your guest user has the appropriate rights."));
    222             break;
    223 
    224         case VERR_NOT_FOUND:
    225             /* Should not happen due to file locking on the guest, but anyway ... */
    226             strError += Utf8StrFmt(pGuest->tr("One or more guest files or directories selected for transferring to the host were not"
    227                                               "found on the guest anymore. This can be the case if the guest files were moved and/or"
    228                                               "altered while the drag and drop operation was in progress."));
    229             break;
    230 
    231         case VERR_SHARING_VIOLATION:
    232             strError += Utf8StrFmt(pGuest->tr("One or more guest files or directories selected for transferring to the host were locked. "
    233                                               "Please make sure that all selected elements can be accessed and that your guest user has "
    234                                               "the appropriate rights."));
    235             break;
    236 
    237         default:
    238             strError += Utf8StrFmt("Drag and drop guest error (%Rrc)", guestRc);
    239             break;
    240     }
    241 
    242     return strError;
    243 }
    244 
    245211int GuestDnDResponse::notifyAboutGuestResponse(void) const
    246212{
     
    312278
    313279int GuestDnDResponse::setProgress(unsigned uPercentage,
    314                                   uint32_t uStatus, int rcOp /* = VINF_SUCCESS */)
    315 {
    316     LogFlowFunc(("uStatus=%RU32, uPercentage=%RU32, rcOp=%Rrc\n",
    317                  uStatus, uPercentage, rcOp));
     280                                  uint32_t uStatus,
     281                                  int rcOp /* = VINF_SUCCESS */, const Utf8Str &strMsg /* = "" */)
     282{
     283    LogFlowFunc(("uStatus=%RU32, uPercentage=%RU32, rcOp=%Rrc, strMsg=%s\n",
     284                 uStatus, uPercentage, rcOp, strMsg.c_str()));
    318285
    319286    int rc = VINF_SUCCESS;
     
    338305                    hr = m_progress->i_notifyComplete(VBOX_E_IPRT_ERROR,
    339306                                                      COM_IIDOF(IGuest),
    340                                                       m_parent->getComponentName(),
    341                                                       GuestDnDResponse::errorToString(m_parent, rcOp).c_str());
     307                                                      m_parent->getComponentName(), strMsg.c_str());
    342308                    reset();
    343309                    break;
     
    898864         * Wait until our desired callback triggered the
    899865         * wait event. As we don't want to block if the guest does not
    900          * respond, so do busy waiting here.
     866         * respond, do busy waiting here.
    901867         */
    902868        rc = Event.Wait(500 /* ms */);
     
    908874        }
    909875        else if (rc == VERR_TIMEOUT) /* Continue waiting. */
    910             rc = VINF_SUCCESS;
     876            continue;
    911877
    912878        if (   msTimeout != RT_INDEFINITE_WAIT
     
    914880        {
    915881            rc = VERR_TIMEOUT;
    916         }
    917         else if (pResp->isProgressCanceled())
    918         {
    919             pResp->setProgress(100 /* Percent */, DragAndDropSvc::DND_PROGRESS_CANCELLED);
     882            LogFlowFunc(("Guest did not respond within time\n"));
     883        }
     884        else if (pResp->isProgressCanceled()) /** @todo GuestDnDResponse *pResp needs to go. */
     885        {
     886            LogFlowFunc(("Canceled by user\n"));
    920887            rc = VERR_CANCELLED;
    921888        }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette