VirtualBox

Ignore:
Timestamp:
Sep 24, 2015 2:05:48 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: work around accidental undefined behaviour in Qt.

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

Legend:

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

    r57809 r57880  
    112112UIMenu* UIAction::menu() const
    113113{
    114     return qobject_cast<UIMenu*>(QAction::menu());
     114    return QAction::menu() ? qobject_cast<UIMenu*>(QAction::menu()) : 0;
    115115}
    116116
     
    959959{
    960960    /* Make sure menu is valid: */
     961    AssertPtrReturnVoid(sender());
    961962    UIMenu *pMenu = qobject_cast<UIMenu*>(sender());
    962963    AssertPtrReturnVoid(pMenu);
    963964    /* Make sure action is valid: */
     965    AssertPtrReturnVoid(pMenu->menuAction());
    964966    UIAction *pAction = qobject_cast<UIAction*>(pMenu->menuAction());
    965967    AssertPtrReturnVoid(pAction);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp

    r57809 r57880  
    314314{
    315315    /* Menu-bar can exist only on QMainWindow sub-class: */
    316     if (QMainWindow *pMainWindow = qobject_cast<QMainWindow*>(pParent))
    317     {
    318         /* Search for existing menu-bar child: */
    319         if (QMenuBar *pMenuBar = pMainWindow->findChild<QMenuBar*>())
    320             return pMenuBar->height();
     316    if (pParent)
     317    {
     318        if (QMainWindow *pMainWindow = qobject_cast<QMainWindow*>(pParent))
     319        {
     320            /* Search for existing menu-bar child: */
     321            if (QMenuBar *pMenuBar = pMainWindow->findChild<QMenuBar*>())
     322                return pMenuBar->height();
     323        }
    321324    }
    322325    /* Zero by default: */
     
    328331{
    329332    /* Status-bar can exist only on QMainWindow sub-class: */
    330     if (QMainWindow *pMainWindow = qobject_cast<QMainWindow*>(pParent))
    331     {
    332         /* Search for existing status-bar child: */
    333         if (QStatusBar *pStatusBar = pMainWindow->findChild<QStatusBar*>())
    334             return pStatusBar->height();
     333    if (pParent)
     334    {
     335        if (QMainWindow *pMainWindow = qobject_cast<QMainWindow*>(pParent))
     336        {
     337            /* Search for existing status-bar child: */
     338            if (QStatusBar *pStatusBar = pMainWindow->findChild<QStatusBar*>())
     339                return pStatusBar->height();
     340        }
    335341    }
    336342    /* Zero by default: */
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