VirtualBox

Changeset 59071 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 9, 2015 10:56:07 PM (9 years ago)
Author:
vboxsync
Message:

UIMachineLogic.cpp: Fixed double free on windows when freeing the LED state during application termination.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r58866 r59071  
    22092209
    22102210    /* Here we have to restore host LED lock states. */
    2211     if (m_pHostLedsState)
    2212     {
     2211    void *pvLedState = m_pHostLedsState;
     2212    if (pvLedState)
     2213    {
     2214        /* bird: I've observed recursive calls here when setting m_pHostLedsState to NULL after calling
     2215                 WinHidDevicesApplyAndReleaseLedsState.  The result is a double free(), which the CRT
     2216                 usually detects and I could see this->m_pHostLedsState == NULL.  The windows function
     2217                 does dispatch loop fun, that's probably the reason for it.  Hopefully not an issue on OS X. */
     2218        m_pHostLedsState = NULL;
    22132219#if defined(Q_WS_MAC)
    2214         DarwinHidDevicesApplyAndReleaseLedsState(m_pHostLedsState);
     2220        DarwinHidDevicesApplyAndReleaseLedsState(pvLedState);
    22152221#elif defined(Q_WS_WIN)
    22162222        keyboardHandler()->winSkipKeyboardEvents(true);
    2217         WinHidDevicesApplyAndReleaseLedsState(m_pHostLedsState);
     2223        WinHidDevicesApplyAndReleaseLedsState(pvLedState);
    22182224        keyboardHandler()->winSkipKeyboardEvents(false);
    22192225#else
    22202226        LogRelFlow(("UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds: restore host LED lock states does not supported on this platform\n"));
    22212227#endif
    2222         m_pHostLedsState = NULL;
    22232228    }
    22242229}
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