Changeset 92878 in vbox
- Timestamp:
- Dec 13, 2021 9:47:14 AM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
-
include/GuestSessionImpl.h (modified) (2 diffs)
-
src-client/GuestSessionImpl.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestSessionImpl.h
r92876 r92878 242 242 enum SESSIONOBJECTTYPE 243 243 { 244 /** @todo r=bird: The tradition is to start at = 1, leaving 0 for invalid or 245 * unused to catch uninitialized data. You do not number the other enum values. 246 * The 32BIT_HACK is only needed for externally visible stuff that might be used 247 * by with different compiler options. 248 * 249 * As noted elsewhere already, SESSIONOBJECTTYPE_ANONYMOUS isn't used 250 * anywhere can be removed till such time as it is needed. Try to not think 251 * too far ahead but if you do, please leave some more useful clues that 252 * "Anonymous object" about the intent. */ 253 /** Anonymous object. */ 254 SESSIONOBJECTTYPE_ANONYMOUS = 0, 244 /** Invalid session object type. */ 245 SESSIONOBJECTTYPE_INVALID = 0, 255 246 /** Session object. */ 256 247 SESSIONOBJECTTYPE_SESSION = 1, … … 260 251 SESSIONOBJECTTYPE_FILE = 3, 261 252 /** Process object. */ 262 SESSIONOBJECTTYPE_PROCESS = 4, 263 /** The usual 32-bit hack. */ 264 SESSIONOBJECTTYPE_32BIT_HACK = 0x7fffffff 253 SESSIONOBJECTTYPE_PROCESS = 4 265 254 }; 266 255 -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r92876 r92878 1243 1243 int rc = VERR_NOT_FOUND; 1244 1244 const uint32_t idObject = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCtxCb->uContextID); 1245 SessionObjects::const_iterator itObj s= mData.mObjects.find(idObject);1246 if (itObj s!= mData.mObjects.end())1245 SessionObjects::const_iterator itObj = mData.mObjects.find(idObject); 1246 if (itObj != mData.mObjects.end()) 1247 1247 { 1248 1248 /* Set protocol version so that pSvcCb can be interpreted right. */ 1249 1249 pCtxCb->uProtocol = mData.mProtocolVersion; 1250 1250 1251 /** @todo r=bird: What is the meaning of this secondary lookup? You've got the 1252 * object pointer (except for SESSION where it's NULL because GuestSession 1253 * doesn't inherit from GuestObject), and can just use the type to upcast it to 1254 * grab a reference then call i_callbackDispatcher. 1255 * 1256 * Also, SESSIONOBJECTTYPE_ANONYMOUS is not used to remove it till needed. 1257 * Don't think too far ahead, and when you do, please express why you think it 1258 * is needed (the documentation of SESSIONOBJECTTYPE_ANONYMOUS is only repeating 1259 * the obvious and not enlightening as to why you though it might come in 1260 * useful). 1261 */ 1262 switch (itObjs->second.enmType) 1263 { 1264 case SESSIONOBJECTTYPE_ANONYMOUS: 1265 rc = VERR_NOT_SUPPORTED; 1266 break; 1267 1251 switch (itObj->second.enmType) 1252 { 1253 /* Note: The session object is special, as it does not inherit from GuestObject we could call 1254 * its dispatcher for -- so treat this separately and call it directly. */ 1268 1255 case SESSIONOBJECTTYPE_SESSION: 1269 1256 { … … 1275 1262 case SESSIONOBJECTTYPE_DIRECTORY: 1276 1263 { 1277 SessionDirectories::const_iterator itDir = mData.mDirectories.find(idObject); 1278 if (itDir != mData.mDirectories.end()) 1279 { 1280 ComObjPtr<GuestDirectory> pDirectory(itDir->second); 1281 Assert(!pDirectory.isNull()); 1282 1283 alock.release(); 1284 1285 rc = pDirectory->i_callbackDispatcher(pCtxCb, pSvcCb); 1286 } 1264 ComObjPtr<GuestDirectory> pObj((GuestDirectory *)itObj->second.pObject); 1265 AssertReturn(!pObj.isNull(), VERR_INVALID_POINTER); 1266 1267 alock.release(); 1268 1269 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); 1287 1270 break; 1288 1271 } 1289 1272 case SESSIONOBJECTTYPE_FILE: 1290 1273 { 1291 SessionFiles::const_iterator itFile = mData.mFiles.find(idObject); 1292 if (itFile != mData.mFiles.end()) 1293 { 1294 ComObjPtr<GuestFile> pFile(itFile->second); 1295 Assert(!pFile.isNull()); 1296 1297 alock.release(); 1298 1299 rc = pFile->i_callbackDispatcher(pCtxCb, pSvcCb); 1300 } 1274 ComObjPtr<GuestFile> pObj((GuestFile *)itObj->second.pObject); 1275 AssertReturn(!pObj.isNull(), VERR_INVALID_POINTER); 1276 1277 alock.release(); 1278 1279 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); 1301 1280 break; 1302 1281 } 1303 1282 case SESSIONOBJECTTYPE_PROCESS: 1304 1283 { 1305 SessionProcesses::const_iterator itProc = mData.mProcesses.find(idObject); 1306 if (itProc != mData.mProcesses.end()) 1307 { 1308 ComObjPtr<GuestProcess> pProcess(itProc->second); 1309 Assert(!pProcess.isNull()); 1310 1311 alock.release(); 1312 1313 rc = pProcess->i_callbackDispatcher(pCtxCb, pSvcCb); 1314 } 1284 ComObjPtr<GuestProcess> pObj((GuestProcess *)itObj->second.pObject); 1285 AssertReturn(!pObj.isNull(), VERR_INVALID_POINTER); 1286 1287 alock.release(); 1288 1289 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); 1315 1290 break; 1316 1291 } 1317 1292 default: 1318 AssertMsgFailed(("%d\n", itObj s->second.enmType));1293 AssertMsgFailed(("%d\n", itObj->second.enmType)); 1319 1294 rc = VERR_INTERNAL_ERROR_4; 1320 1295 break;
Note:
See TracChangeset
for help on using the changeset viewer.

