Changeset 79889 in vbox
- Timestamp:
- Jul 19, 2019 3:45:15 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 132293
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r79365 r79889 2493 2493 } 2494 2494 2495 CSession UICommon::tryToOpenSessionFor(CMachine &comMachine) 2496 { 2497 /* Prepare session: */ 2498 CSession comSession; 2499 2500 /* Session state unlocked? */ 2501 if (comMachine.GetSessionState() == KSessionState_Unlocked) 2502 { 2503 /* Open own 'write' session: */ 2504 comSession = openSession(comMachine.GetId()); 2505 AssertReturn(!comSession.isNull(), CSession()); 2506 comMachine = comSession.GetMachine(); 2507 } 2508 /* Is this a Selector UI call? */ 2509 else if (uiType() == UIType_SelectorUI) 2510 { 2511 /* Open existing 'shared' session: */ 2512 comSession = openExistingSession(comMachine.GetId()); 2513 AssertReturn(!comSession.isNull(), CSession()); 2514 comMachine = comSession.GetMachine(); 2515 } 2516 /* Else this is Runtime UI call 2517 * which has session locked for itself. */ 2518 2519 /* Return session: */ 2520 return comSession; 2521 } 2522 2495 2523 void UICommon::startMediumEnumeration(const CMediumVector &comMedia /* = CMediumVector() */) 2496 2524 { … … 3244 3272 return; 3245 3273 3246 /* Get editable machine: */ 3247 CSession comSession; 3274 /* Get editable machine & session: */ 3248 3275 CMachine comMachine = comConstMachine; 3249 KSessionState enmSessionState = comMachine.GetSessionState(); 3250 /* Session state unlocked? */ 3251 if (enmSessionState == KSessionState_Unlocked) 3252 { 3253 /* Open own 'write' session: */ 3254 comSession = openSession(comMachine.GetId()); 3255 AssertReturnVoid(!comSession.isNull()); 3256 comMachine = comSession.GetMachine(); 3257 } 3258 /* Is this a Selector UI call? */ 3259 else if (uiType() == UIType_SelectorUI) 3260 { 3261 /* Open existing 'shared' session: */ 3262 comSession = openExistingSession(comMachine.GetId()); 3263 AssertReturnVoid(!comSession.isNull()); 3264 comMachine = comSession.GetMachine(); 3265 } 3266 /* Else this is Runtime UI call 3267 * which has session locked for itself. */ 3276 CSession comSession = tryToOpenSessionFor(comMachine); 3268 3277 3269 3278 /* Remount medium to the predefined port/device: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r79365 r79889 472 472 /** Opens session of KLockType_Shared type for VM with certain @a uId. */ 473 473 CSession openExistingSession(const QUuid &uId) { return openSession(uId, KLockType_Shared); } 474 /** Tries to guess if new @a comSession needs to be opened for certain @a comMachine, 475 * if yes, new session of required type will be opened and machine will be updated, 476 * otherwise, no session will be created and machine will be left unchanged. */ 477 CSession tryToOpenSessionFor(CMachine &comMachine); 474 478 /** @} */ 475 479
Note:
See TracChangeset
for help on using the changeset viewer.