VirtualBox

Changeset 97801 in vbox


Ignore:
Timestamp:
Dec 14, 2022 2:50:42 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154876
Message:

DnD/Main: Some more reset handling fixes.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestDnDPrivate.h

    r97788 r97801  
    853853     * @{ */
    854854    bool isProgressCanceled(void) const;
     855    bool isProgressRunning(void) const;
    855856    int setProgress(unsigned uPercentage, uint32_t uState, int rcOp = VINF_SUCCESS, const Utf8Str &strMsg = "");
    856857    HRESULT resetProgress(const ComObjPtr<Guest>& pParent);
  • trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp

    r97798 r97801  
    356356 *
    357357 * @returns VBox status code. Will get sent back to the host service.
     358 * @retval  VERR_NO_DATA if no new messages from the host side are available at the moment.
    358359 * @retval  VERR_CANCELLED for indicating that the current operation was cancelled.
    359360 * @param   uMsg                HGCM message ID (function number).
     
    395396        }
    396397
     398        case GUEST_DND_FN_GET_NEXT_HOST_MSG:
     399            vrc = VERR_NO_DATA; /* Indicate back to the host service that there are no new messages. */
     400            break;
     401
    397402        default:
    398             AssertMsgBreakStmt(pThis->isProgressCanceled(), ("Transfer not cancelled (yet)!\n"), vrc = VERR_INVALID_STATE);
     403            AssertMsgBreakStmt(pThis->isProgressRunning() == false,
     404                               ("Progress object not completed / canceld yet! State is '%s' (%#x)\n",
     405                                DnDStateToStr(pThis->m_enmState), pThis->m_enmState),
     406                               vrc = VERR_INVALID_STATE); /* Please report this! */
    399407            vrc = VERR_CANCELLED;
    400408            break;
     
    429437 * Returns whether the progress object has been canceled or not.
    430438 *
    431  * @returns \c true if canceled, \c false if not.
     439 * @returns \c true if canceled or progress does not exist, \c false if not.
    432440 */
    433441bool GuestDnDState::isProgressCanceled(void) const
    434442{
     443    if (m_pProgress.isNull())
     444        return true;
     445
    435446    BOOL fCanceled;
    436     if (!m_pProgress.isNull())
    437     {
    438         HRESULT hr = m_pProgress->COMGETTER(Canceled)(&fCanceled);
    439         AssertComRC(hr);
    440     }
    441     else
    442         fCanceled = TRUE;
    443 
     447    HRESULT hr = m_pProgress->COMGETTER(Canceled)(&fCanceled);
     448    AssertComRCReturn(hr, false);
    444449    return RT_BOOL(fCanceled);
     450}
     451
     452/**
     453 * Returns whether the progress object still is in a running state or not.
     454 *
     455 * @returns \c true if running, \c false if not.
     456 */
     457bool GuestDnDState::isProgressRunning(void) const
     458{
     459    if (m_pProgress.isNull())
     460        return false;
     461
     462    BOOL fRunning;
     463    HRESULT hr = m_pProgress->COMGETTER(Completed)(&fRunning);
     464    AssertComRCReturn(hr, false);
     465    return RT_BOOL(fRunning);
    445466}
    446467
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