VirtualBox

Ignore:
Timestamp:
Oct 30, 2018 4:54:34 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: UIActionPoolRuntime: Prevent theoretically possible crash (like the one mentioned in r126267) if menu update handler belongs to base-class, not inherited one.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp

    r75185 r75191  
    23542354void UIActionPool::updateMenu(int iIndex)
    23552355{
    2356     /* Update if menu with such index is invalidated and there is update-handler: */
    2357     if (m_invalidations.contains(iIndex) && m_menuUpdateHandlers.contains(iIndex))
     2356    /* Make sure index belongs to this class: */
     2357    AssertReturnVoid(iIndex < UIActionIndex_Max);
     2358
     2359    /* If menu with such index is invalidated
     2360     * and there is update-handler => handle it here: */
     2361    if (   m_invalidations.contains(iIndex)
     2362        && m_menuUpdateHandlers.contains(iIndex))
    23582363        (this->*(m_menuUpdateHandlers.value(iIndex).ptf))();
    23592364}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp

    r75087 r75191  
    35063506void UIActionPoolRuntime::updateMenu(int iIndex)
    35073507{
    3508     /* Call to base-class: */
     3508    /* If index belongs to base-class => delegate to base-class: */
    35093509    if (iIndex < UIActionIndex_Max)
    35103510        UIActionPool::updateMenu(iIndex);
    3511 
    3512     /* If menu with such index is invalidated and there is update-handler: */
    3513     if (m_invalidations.contains(iIndex) && m_menuUpdateHandlers.contains(iIndex))
    3514         (this->*(m_menuUpdateHandlers.value(iIndex).ptfr))();
     3511    /* Otherwise,
     3512     * if menu with such index is invalidated
     3513     * and there is update-handler => handle it here: */
     3514    else if (   iIndex > UIActionIndex_Max
     3515             && m_invalidations.contains(iIndex)
     3516             && m_menuUpdateHandlers.contains(iIndex))
     3517             (this->*(m_menuUpdateHandlers.value(iIndex).ptfr))();
    35153518}
    35163519
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