Changeset 76955 in vbox
- Timestamp:
- Jan 23, 2019 4:27:57 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/GuestControl/service.cpp
r76553 r76955 973 973 */ 974 974 ClientState *pClient; 975 //try - can't currently throw anything.975 try 976 976 { 977 977 pClient = new (pvClient) ClientState(pThis->mpHelpers, idClient); 978 }979 //catch (std::bad_alloc &)980 //{981 // return VERR_NO_MEMORY;982 //}983 try984 {985 978 pThis->m_ClientStateMap[idClient] = pClient; 986 979 } 987 980 catch (std::bad_alloc &) 988 981 { 989 pClient->~ClientState(); 982 if (pClient) 983 pClient->~ClientState(); 990 984 return VERR_NO_MEMORY; 991 985 } … … 2135 2129 { 2136 2130 VBOXGUESTCTRLHOSTCALLBACK data(cParms, paParms); 2137 /** @todo Not sure if this try/catch is necessary, I pushed it down here from 2138 * GstCtrlService::call where it was not needed for anything else that I 2139 * could spot. I know this might be a tough, but I expect someone writing 2140 * this kind of code to know what can throw errors and handle them where it 2141 * is appropriate, rather than grand catch-all-at-the-top crap like this. 2142 * The reason why it is utter crap, is that you have no state cleanup code 2143 * where you might need it, which is why I despise exceptions in general */ 2144 try 2145 { 2146 rc = mpfnHostCallback(mpvHostData, idFunction, &data, sizeof(data)); 2147 } 2148 catch (std::bad_alloc &) 2149 { 2150 rc = VERR_NO_MEMORY; 2151 } 2131 rc = mpfnHostCallback(mpvHostData, idFunction, &data, sizeof(data)); 2152 2132 } 2153 2133 else
Note:
See TracChangeset
for help on using the changeset viewer.

