VirtualBox

Changeset 99134 in vbox for trunk


Ignore:
Timestamp:
Mar 23, 2023 10:30:09 AM (19 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Small simplification for machine-logic cleanup procedure.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
3 edited

Legend:

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

    r98983 r99134  
    11131113    if (pMachineLogic->checkAvailability())
    11141114    {
    1115         /* Delete previous machine-logic if exists: */
    1116         if (m_pMachineLogic)
    1117         {
    1118             m_pMachineLogic->cleanup();
    1119             UIMachineLogic::destroy(m_pMachineLogic);
    1120             m_pMachineLogic = 0;
    1121         }
     1115        /* Delete previous machine-logic if any: */
     1116        UIMachineLogic::destroy(m_pMachineLogic);
    11221117
    11231118        /* Set the new machine-logic as current one: */
     
    11341129    {
    11351130        /* Delete temporary created machine-logic: */
    1136         pMachineLogic->cleanup();
    11371131        UIMachineLogic::destroy(pMachineLogic);
    11381132    }
     
    17931787void UIMachine::cleanupMachineLogic()
    17941788{
    1795     /* Destroy machine-logic if exists: */
    1796     if (m_pMachineLogic)
    1797     {
    1798         m_pMachineLogic->cleanup();
    1799         UIMachineLogic::destroy(m_pMachineLogic);
    1800         m_pMachineLogic = 0;
    1801     }
     1789    /* Delete machine-logic if any: */
     1790    UIMachineLogic::destroy(m_pMachineLogic);
    18021791}
    18031792
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r99092 r99134  
    175175
    176176/* static */
    177 void UIMachineLogic::destroy(UIMachineLogic *pLogic)
    178 {
     177void UIMachineLogic::destroy(UIMachineLogic *&pLogic)
     178{
     179    if (!pLogic)
     180        return;
     181    pLogic->cleanup();
    179182    delete pLogic;
     183    pLogic = 0;
    180184}
    181185
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r98952 r99134  
    7272    static UIMachineLogic *create(UIMachine *pMachine, UIVisualStateType enmVisualStateType);
    7373    /** Factory function to destroy passed @a pLogic. */
    74     static void destroy(UIMachineLogic *pLogic);
     74    static void destroy(UIMachineLogic *&pLogic);
    7575
    7676    /** Returns visual state type. */
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