- Timestamp:
- Apr 2, 2013 10:41:19 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r45278 r45279 1999 1999 const QStringList &oldGroupList = m_oldLists.value(strId); 2000 2000 const UIStringSet &oldGroupSet = UIStringSet::fromList(oldGroupList); 2001 /* Is group set changed? */ 2002 if (newGroupSet != oldGroupSet) 2003 { 2004 /* Open session to modify iterated machine: */ 2005 CSession session = vboxGlobal().openSession(strId); 2001 /* Make sure group set was changed: */ 2002 if (newGroupSet == oldGroupSet) 2003 continue; 2004 2005 /* The next steps are subsequent. 2006 * Every of them is mandatory in order to continue 2007 * with common cleanup in case of failure. 2008 * We have to simulate a try-catch block. */ 2009 bool fSuccess = false; 2010 CSession session; 2011 CMachine machine; 2012 do 2013 { 2014 /* 1. Open session: */ 2015 session = vboxGlobal().openSession(strId); 2006 2016 if (session.isNull()) 2007 { 2008 emit sigReload(strId); 2009 continue; 2010 } 2011 2012 /* Get session machine: */ 2013 CMachine machine = session.GetMachine(); 2014 AssertMsg(!machine.isNull(), ("Session machine is NULL!")); 2017 break; 2018 2019 /* 2. Get session machine: */ 2020 machine = session.GetMachine(); 2015 2021 if (machine.isNull()) 2016 { 2017 emit sigReload(strId); 2018 continue; 2019 } 2020 2021 /* Set groups: */ 2022 break; 2023 2024 /* 3. Set new groups: */ 2022 2025 machine.SetGroups(newGroupList.toVector()); 2023 2026 if (!machine.isOk()) 2024 { 2025 msgCenter().cannotSetGroups(machine); 2026 emit sigReload(strId); 2027 continue; 2028 } 2029 2030 /* Save settings: */ 2027 break; 2028 2029 /* 4. Save settings: */ 2031 2030 machine.SaveSettings(); 2032 2031 if (!machine.isOk()) 2033 { 2032 break; 2033 2034 /* Transaction complete: */ 2035 fSuccess = true; 2036 } while (0); 2037 2038 /* Cleanup if necessary: */ 2039 if (!fSuccess) 2040 { 2041 if (!machine.isNull()) 2034 2042 msgCenter().cannotSaveMachineSettings(machine); 2035 emit sigReload(strId); 2036 continue; 2037 } 2038 2039 /* Close the session finally: */ 2043 emit sigReload(strId); 2044 } 2045 if (!session.isNull()) 2040 2046 session.UnlockMachine(); 2041 }2042 2047 } 2043 2048
Note:
See TracChangeset
for help on using the changeset viewer.