Changeset 98902 in vbox
- Timestamp:
- Mar 10, 2023 2:20:21 PM (21 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98882 r98902 172 172 /* Create machine UI: */ 173 173 new UIMachine; 174 174 175 /* Make sure it's prepared: */ 175 176 if (!s_pInstance->prepare()) … … 180 181 return false; 181 182 } 183 182 184 /* True by default: */ 183 185 return true; … … 1456 1458 bool UIMachine::prepare() 1457 1459 { 1458 /* Try to create session UI: */ 1459 if (!UISession::create(m_pSession, this)) 1460 /* Create session UI: */ 1461 m_pSession = new UISession(this); 1462 AssertPtrReturn(uisession(), false); 1463 /* And make sure it's prepared: */ 1464 if (!uisession()->prepare()) 1460 1465 return false; 1461 AssertPtrReturn(uisession(), false);1462 1466 1463 1467 /* Prepare stuff: */ … … 1813 1817 { 1814 1818 /* Destroy session UI if exists: */ 1815 if (uisession())1816 UISession::destroy(m_pSession);1819 delete m_pSession; 1820 m_pSession = 0; 1817 1821 } 1818 1822 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98882 r98902 105 105 #endif 106 106 107 /* static */ 108 bool UISession::create(UISession *&pSession, UIMachine *pMachine) 109 { 110 /* Make sure NULL pointer passed: */ 111 AssertReturn(!pSession, false); 112 113 /* Create session UI: */ 114 pSession = new UISession(pMachine); 115 AssertPtrReturn(pSession, false); 116 117 /* Make sure it's prepared: */ 118 if (!pSession->prepare()) 119 { 120 /* Destroy session UI otherwise: */ 121 destroy(pSession); 122 /* False in that case: */ 107 UISession::UISession(UIMachine *pMachine) 108 : QObject(pMachine) 109 /* Base variables: */ 110 , m_pMachine(pMachine) 111 , m_pConsoleEventhandler(0) 112 /* Common variables: */ 113 , m_enmMachineStatePrevious(KMachineState_Null) 114 , m_enmMachineState(KMachineState_Null) 115 /* Guest additions flags: */ 116 , m_ulGuestAdditionsRunLevel(0) 117 , m_fIsGuestSupportsGraphics(false) 118 , m_fIsGuestSupportsSeamless(false) 119 #ifdef VBOX_WITH_DEBUGGER_GUI 120 /* Debug UI stuff: */ 121 , m_pDbgGui(0) 122 , m_pDbgGuiVT(0) 123 #endif /* VBOX_WITH_DEBUGGER_GUI */ 124 { 125 } 126 127 bool UISession::prepare() 128 { 129 /* Prepare COM stuff: */ 130 if (!prepareSession()) 123 131 return false; 124 } 132 133 /* Cache media early if requested: */ 134 if (uiCommon().agressiveCaching()) 135 recacheMachineMedia(); 136 137 /* Prepare GUI stuff: */ 138 prepareNotificationCenter(); 139 prepareConsoleEventHandlers(); 140 prepareFramebuffers(); 141 prepareConnections(); 142 prepareSignalHandling(); 125 143 126 144 /* True by default: */ 127 145 return true; 128 }129 130 /* static */131 void UISession::destroy(UISession *&pSession)132 {133 /* Make sure valid pointer passed: */134 AssertPtrReturnVoid(pSession);135 136 /* Delete session: */137 delete pSession;138 pSession = 0;139 146 } 140 147 … … 2232 2239 cleanupConsoleEventHandlers(); 2233 2240 cleanupNotificationCenter(); 2234 cleanup Session();2241 cleanupCOMStuff(); 2235 2242 } 2236 2243 … … 2322 2329 /* Close Runtime UI independent of snapshot restoring state: */ 2323 2330 uimachine()->closeRuntimeUI(); 2324 }2325 2326 UISession::UISession(UIMachine *pMachine)2327 : QObject(pMachine)2328 /* Base variables: */2329 , m_pMachine(pMachine)2330 , m_pConsoleEventhandler(0)2331 /* Common variables: */2332 , m_enmMachineStatePrevious(KMachineState_Null)2333 , m_enmMachineState(KMachineState_Null)2334 /* Guest additions flags: */2335 , m_ulGuestAdditionsRunLevel(0)2336 , m_fIsGuestSupportsGraphics(false)2337 , m_fIsGuestSupportsSeamless(false)2338 #ifdef VBOX_WITH_DEBUGGER_GUI2339 /* Debug UI stuff: */2340 , m_pDbgGui(0)2341 , m_pDbgGuiVT(0)2342 #endif /* VBOX_WITH_DEBUGGER_GUI */2343 {2344 }2345 2346 UISession::~UISession()2347 {2348 }2349 2350 bool UISession::prepare()2351 {2352 /* Prepare COM stuff: */2353 if (!prepareSession())2354 return false;2355 2356 /* Cache media early if requested: */2357 if (uiCommon().agressiveCaching())2358 recacheMachineMedia();2359 2360 /* Prepare GUI stuff: */2361 prepareNotificationCenter();2362 prepareConsoleEventHandlers();2363 prepareFramebuffers();2364 prepareConnections();2365 prepareSignalHandling();2366 2367 /* True by default: */2368 return true;2369 2331 } 2370 2332 … … 2547 2509 } 2548 2510 2549 void UISession::cleanup Session()2511 void UISession::cleanupCOMStuff() 2550 2512 { 2551 2513 /* Detach debugger: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98882 r98902 146 146 public: 147 147 148 /** Constructs session UI passing @a pMachine to the constructor. 149 * @param pSession Brings the pointer to the session UI being constructed. 148 /** Constructs session UI passing @a pMachine to the base-class. 150 149 * @param pMachine Brings the machine UI reference. */ 151 static bool create(UISession *&pSession, UIMachine *pMachine); 152 /** Destructs session UI. 153 * @param pSession Brings the pointer to the session UI being destructed. */ 154 static void destroy(UISession *&pSession); 150 UISession(UIMachine *pMachine); 155 151 156 152 /** @name General stuff. 157 153 ** @{ */ 154 /** Prepares everything. */ 155 bool prepare(); 158 156 /** Performs session UI intialization. */ 159 157 bool initialize(); … … 648 646 private: 649 647 650 /** Constructs session UI passing @a pMachine to the base-class.651 * @param pMachine Brings the machine UI reference. */652 UISession(UIMachine *pMachine);653 /** Destructs session UI. */654 virtual ~UISession() RT_OVERRIDE;655 656 648 /** @name Prepare/cleanup cascade. 657 649 ** @{ */ 658 /** Prepares everything. */659 bool prepare();660 650 /** Prepares COM session. */ 661 651 bool prepareSession(); … … 677 667 /** Cleanups notification-center. */ 678 668 void cleanupNotificationCenter(); 679 /** Cleanups COM s ession. */680 void cleanup Session();669 /** Cleanups COM stuff. */ 670 void cleanupCOMStuff(); 681 671 /** @} */ 682 672
Note:
See TracChangeset
for help on using the changeset viewer.