Changeset 49504 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 15, 2013 1:19:45 PM (11 years ago)
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r49392 r49504 347 347 int rc = VERR_NOT_FOUND; 348 348 349 LogFlow Func(("Closing session (ID=%RU32) ...\n", pSession->getId()));349 LogFlowThisFunc(("Removing session (ID=%RU32) ...\n", pSession->getId())); 350 350 351 351 GuestSessions::iterator itSessions = mData.mGuestSessions.begin(); … … 354 354 if (pSession == itSessions->second) 355 355 { 356 #ifdef DEBUG_andy 357 ULONG cRefs = pSession->AddRef(); 358 Assert(cRefs >= 2); 359 LogFlowThisFunc(("pCurSession=%p, cRefs=%RU32\n", pSession, cRefs - 2)); 360 pSession->Release(); 361 #endif 356 362 /* Make sure to consume the pointer before the one of the 357 363 * iterator gets released. */ 358 364 ComObjPtr<GuestSession> pCurSession = pSession; 359 365 360 LogFlowFunc(("Removing session (pSession=%p, ID=%RU32) (now total %ld sessions)\n", 361 pSession, pSession->getId(), mData.mGuestSessions.size() - 1)); 362 363 itSessions->second->Release(); 364 366 LogFlowThisFunc(("Removing session (pSession=%p, ID=%RU32) (now total %ld sessions)\n", 367 pSession, pSession->getId(), mData.mGuestSessions.size() - 1)); 368 369 rc = pSession->onRemove(); 365 370 mData.mGuestSessions.erase(itSessions); 366 371 … … 369 374 fireGuestSessionRegisteredEvent(mEventSource, pCurSession, 370 375 false /* Unregistered */); 371 rc = VINF_SUCCESS;376 pCurSession.setNull(); 372 377 break; 373 378 } -
trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
r49349 r49504 133 133 void GuestDirectory::uninit(void) 134 134 { 135 LogFlowThisFunc (("\n"));135 LogFlowThisFuncEnter(); 136 136 137 137 /* Enclose the state transition Ready->InUninit->NotReady. */ … … 246 246 247 247 return strError; 248 } 249 250 /** 251 * Called by IGuestSession right before this directory gets 252 * removed from the public directory list. 253 */ 254 int GuestDirectory::onRemove(void) 255 { 256 LogFlowThisFuncEnter(); 257 258 int vrc = VINF_SUCCESS; 259 260 LogFlowFuncLeaveRC(vrc); 261 return vrc; 248 262 } 249 263 -
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r49440 r49504 1 2 1 /* $Id$ */ 3 2 /** @file … … 79 78 int rc2 = mFile->signalWaitEvent(aType, aEvent); 80 79 #ifdef DEBUG_andy 81 LogFlowFunc(("Signalling events of type=% ld, file=%p resulted in rc=%Rrc\n",80 LogFlowFunc(("Signalling events of type=%RU32, file=%p resulted in rc=%Rrc\n", 82 81 aType, mFile, rc2)); 83 82 #endif … … 86 85 87 86 default: 88 AssertMsgFailed(("Unhandled event % ld\n", aType));87 AssertMsgFailed(("Unhandled event %RU32\n", aType)); 89 88 break; 90 89 } … … 225 224 void GuestFile::uninit(void) 226 225 { 227 LogFlowThisFuncEnter();228 229 226 /* Enclose the state transition Ready->InUninit->NotReady. */ 230 227 AutoUninitSpan autoUninitSpan(this); … … 232 229 return; 233 230 231 LogFlowThisFuncEnter(); 232 234 233 #ifdef VBOX_WITH_GUEST_CONTROL 235 234 baseUninit(); 236 237 if (!mEventSource.isNull())238 {239 mEventSource->UnregisterListener(mLocalListener);240 241 mLocalListener.setNull();242 unconst(mEventSource).setNull();243 }244 235 #endif 245 246 236 LogFlowThisFuncLeave(); 247 237 } … … 707 697 708 698 int vrc = setFileStatus(FileStatus_Down, VINF_SUCCESS); 699 700 LogFlowFuncLeaveRC(vrc); 701 return vrc; 702 } 703 704 /** 705 * Called by IGuestSession right before this file gets removed 706 * from the public file list. 707 */ 708 int GuestFile::onRemove(void) 709 { 710 LogFlowThisFuncEnter(); 711 712 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 713 714 int vrc = VINF_SUCCESS; 715 716 /* 717 * Note: The event source stuff holds references to this object, 718 * so make sure that this is cleaned up *before* calling uninit(). 719 */ 720 if (!mEventSource.isNull()) 721 { 722 mEventSource->UnregisterListener(mLocalListener); 723 724 mLocalListener.setNull(); 725 unconst(mEventSource).setNull(); 726 } 709 727 710 728 LogFlowFuncLeaveRC(vrc); … … 944 962 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 945 963 946 LogFlowThisFunc(("oldStatus=% ld, newStatus=%ld, fileRc=%Rrc\n",964 LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, fileRc=%Rrc\n", 947 965 mData.mStatus, fileStatus, fileRc)); 948 966 -
trunk/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp
r42897 r49504 1 2 1 /* $Id$ */ 3 2 /** @file 4 * VirtualBox Main - XXX.3 * VirtualBox Main - Guest file system object information handling. 5 4 */ 6 5 -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r49440 r49504 1 2 1 /* $Id$ */ 3 2 /** @file … … 118 117 int rc2 = mProcess->signalWaitEvent(aType, aEvent); 119 118 #ifdef DEBUG 120 LogFlowThisFunc(("Signalling events of type=% ld, pProcess=%p resulted in rc=%Rrc\n",119 LogFlowThisFunc(("Signalling events of type=%RU32, pProcess=%p resulted in rc=%Rrc\n", 121 120 aType, &mProcess, rc2)); 122 121 #endif … … 125 124 126 125 default: 127 AssertMsgFailed(("Unhandled event % ld\n", aType));126 AssertMsgFailed(("Unhandled event %RU32\n", aType)); 128 127 break; 129 128 } … … 256 255 /** 257 256 * Uninitializes the instance. 258 * Called from FinalRelease() .257 * Called from FinalRelease() or IGuestSession::uninit(). 259 258 */ 260 259 void GuestProcess::uninit(void) 261 260 { 262 LogFlowThisFuncEnter();263 264 261 /* Enclose the state transition Ready->InUninit->NotReady. */ 265 262 AutoUninitSpan autoUninitSpan(this); … … 267 264 return; 268 265 266 #ifdef VBOX_WITH_GUEST_CONTROL 269 267 LogFlowThisFunc(("mCmd=%s, PID=%RU32\n", 270 268 mData.mProcess.mCommand.c_str(), mData.mPID)); … … 276 274 * case of failure. */ 277 275 278 #ifdef VBOX_WITH_GUEST_CONTROL279 276 baseUninit(); 280 281 if (!mEventSource.isNull())282 {283 mEventSource->UnregisterListener(mLocalListener);284 285 mLocalListener.setNull();286 unconst(mEventSource).setNull();287 }288 #endif289 277 290 278 LogFlowThisFunc(("Returning rc=%Rrc, guestRc=%Rrc\n", 291 279 vrc, guestRc)); 280 #endif 292 281 } 293 282 … … 826 815 } 827 816 828 LogFlowThisFunc(("Got rc=%Rrc, procSts=% ld, procRc=%Rrc\n",817 LogFlowThisFunc(("Got rc=%Rrc, procSts=%RU32, procRc=%Rrc\n", 829 818 vrc, procStatus, procRc)); 830 819 … … 875 864 } 876 865 866 /** 867 * Called by IGuestSession right before this process gets 868 * removed from the public process list. 869 */ 870 int GuestProcess::onRemove(void) 871 { 872 LogFlowThisFuncEnter(); 873 874 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 875 876 int vrc = VINF_SUCCESS; 877 878 /* 879 * Note: The event source stuff holds references to this object, 880 * so make sure that this is cleaned up *before* calling uninit(). 881 */ 882 if (!mEventSource.isNull()) 883 { 884 mEventSource->UnregisterListener(mLocalListener); 885 886 mLocalListener.setNull(); 887 unconst(mEventSource).setNull(); 888 } 889 890 LogFlowFuncLeaveRC(vrc); 891 return vrc; 892 } 893 877 894 int GuestProcess::readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, 878 895 void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc) … … 962 979 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 963 980 964 LogFlowThisFunc(("oldStatus=% ld, newStatus=%ld, procRc=%Rrc\n",981 LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, procRc=%Rrc\n", 965 982 mData.mStatus, procStatus, procRc)); 966 983 … … 1236 1253 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1237 1254 1255 int vrc = VINF_SUCCESS; 1256 1238 1257 if (mData.mStatus != ProcessStatus_Started) 1239 1258 { 1240 LogFlowThisFunc(("Process not started state (state is %ld), skipping termination\n",1259 LogFlowThisFunc(("Process not in started state (state is %RU32), skipping termination\n", 1241 1260 mData.mStatus)); 1242 return VINF_SUCCESS; /* Nothing to do (anymore). */ 1243 } 1244 1245 int vrc = VINF_SUCCESS; 1246 1247 AssertPtr(mSession); 1248 /* Note: VBox < 4.3 (aka protocol version 1) does not 1249 * support this, so just skip. */ 1250 if (mSession->getProtocolVersion() < 2) 1251 vrc = VERR_NOT_SUPPORTED; 1252 1253 if (RT_SUCCESS(vrc)) 1254 { 1255 GuestWaitEvent *pEvent = NULL; 1256 GuestEventTypes eventTypes; 1257 try 1258 { 1259 eventTypes.push_back(VBoxEventType_OnGuestProcessStateChanged); 1260 1261 vrc = registerWaitEvent(eventTypes, &pEvent); 1262 } 1263 catch (std::bad_alloc) 1264 { 1265 vrc = VERR_NO_MEMORY; 1266 } 1267 1268 if (RT_FAILURE(vrc)) 1269 return vrc; 1270 1271 VBOXHGCMSVCPARM paParms[4]; 1272 int i = 0; 1273 paParms[i++].setUInt32(pEvent->ContextID()); 1274 paParms[i++].setUInt32(mData.mPID); 1275 1276 alock.release(); /* Drop the write lock before sending. */ 1277 1278 vrc = sendCommand(HOST_EXEC_TERMINATE, i, paParms); 1261 } 1262 else 1263 { 1264 AssertPtr(mSession); 1265 /* Note: VBox < 4.3 (aka protocol version 1) does not 1266 * support this, so just skip. */ 1267 if (mSession->getProtocolVersion() < 2) 1268 vrc = VERR_NOT_SUPPORTED; 1269 1279 1270 if (RT_SUCCESS(vrc)) 1280 vrc = waitForStatusChange(pEvent, uTimeoutMS, 1281 NULL /* ProcessStatus */, pGuestRc); 1282 unregisterWaitEvent(pEvent); 1271 { 1272 GuestWaitEvent *pEvent = NULL; 1273 GuestEventTypes eventTypes; 1274 try 1275 { 1276 eventTypes.push_back(VBoxEventType_OnGuestProcessStateChanged); 1277 1278 vrc = registerWaitEvent(eventTypes, &pEvent); 1279 } 1280 catch (std::bad_alloc) 1281 { 1282 vrc = VERR_NO_MEMORY; 1283 } 1284 1285 if (RT_FAILURE(vrc)) 1286 return vrc; 1287 1288 VBOXHGCMSVCPARM paParms[4]; 1289 int i = 0; 1290 paParms[i++].setUInt32(pEvent->ContextID()); 1291 paParms[i++].setUInt32(mData.mPID); 1292 1293 alock.release(); /* Drop the write lock before sending. */ 1294 1295 vrc = sendCommand(HOST_EXEC_TERMINATE, i, paParms); 1296 if (RT_SUCCESS(vrc)) 1297 vrc = waitForStatusChange(pEvent, uTimeoutMS, 1298 NULL /* ProcessStatus */, pGuestRc); 1299 unregisterWaitEvent(pEvent); 1300 } 1283 1301 } 1284 1302 … … 1337 1355 1338 1356 default: 1339 AssertMsgFailed(("Unhandled old status % ldbefore new status 'started'\n",1357 AssertMsgFailed(("Unhandled old status %RU32 before new status 'started'\n", 1340 1358 oldStatus)); 1341 1359 waitResult = ProcessWaitResult_Start; … … 1381 1399 1382 1400 #ifdef DEBUG 1383 LogFlowFunc(("oldStatus=% ld, newStatus=%ld, fWaitFlags=0x%x, waitResult=%ld\n",1401 LogFlowFunc(("oldStatus=%RU32, newStatus=%RU32, fWaitFlags=0x%x, waitResult=%RU32\n", 1384 1402 oldStatus, newStatus, fWaitFlags, waitResult)); 1385 1403 #endif … … 1478 1496 mData.mProcess.mFlags, mSession->getProtocolVersion()); 1479 1497 #ifdef DEBUG 1480 LogFlowThisFunc(("Got new status change: fWaitFlags=0x%x, newStatus=% ld, waitResult=%ld\n",1498 LogFlowThisFunc(("Got new status change: fWaitFlags=0x%x, newStatus=%RU32, waitResult=%RU32\n", 1481 1499 fWaitFlags, newStatus, waitResult)); 1482 1500 #endif … … 1492 1510 unregisterWaitEvent(pEvent); 1493 1511 1494 LogFlowThisFunc(("Returned waitResult=% ld, newStatus=%ld, rc=%Rrc\n",1512 LogFlowThisFunc(("Returned waitResult=%RU32, newStatus=%RU32, rc=%Rrc\n", 1495 1513 waitResult, newStatus, vrc)); 1496 1514 return vrc; … … 1860 1878 } 1861 1879 1862 /* Remove the process from our internal session list. Only an API client1863 * now mayhold references to it. */1880 /* Remove process from guest session list. Now only API clients 1881 * still can hold references to it. */ 1864 1882 AssertPtr(mSession); 1865 1883 mSession->processRemoveFromList(this); … … 2016 2034 2017 2035 GuestProcessTool::GuestProcessTool(void) 2018 : pSession(NULL) 2036 : pSession(NULL), 2037 pProcess(NULL) 2019 2038 { 2020 2039 } … … 2041 2060 int vrc = pSession->processCreateExInteral(mStartupInfo, pProcess); 2042 2061 if (RT_SUCCESS(vrc)) 2043 vrc = fAsync ? pProcess->startProcessAsync() : pProcess->startProcess(30 * 1000 /* 30s timeout */, 2044 pGuestRc); 2062 vrc = fAsync 2063 ? pProcess->startProcessAsync() 2064 : pProcess->startProcess(30 * 1000 /* 30s timeout */, pGuestRc); 2045 2065 2046 2066 if ( RT_SUCCESS(vrc) … … 2091 2111 Assert(SUCCEEDED(hr)); 2092 2112 2093 if ( procStatus != ProcessStatus_Started2094 && procStatus != ProcessStatus_Paused2095 && procStatus != ProcessStatus_Terminating)2096 { 2097 return false;2098 } 2099 2100 return true;2113 if ( procStatus == ProcessStatus_Started 2114 || procStatus == ProcessStatus_Paused 2115 || procStatus == ProcessStatus_Terminating) 2116 { 2117 return true; 2118 } 2119 2120 return false; 2101 2121 } 2102 2122 … … 2147 2167 Assert(RT_SUCCESS(guestRc)); 2148 2168 guestRc = procTool.TerminatedOk(NULL /* Exit code */); 2169 if (RT_FAILURE(guestRc)) 2170 vrc = VERR_GSTCTL_GUEST_ERROR; 2149 2171 if (pGuestRc) 2150 2172 *pGuestRc = guestRc; … … 2300 2322 2301 2323 default: 2302 AssertReleaseMsgFailed(("Unhandled process wait result % ld\n", waitRes));2324 AssertReleaseMsgFailed(("Unhandled process wait result %RU32\n", waitRes)); 2303 2325 break; 2304 2326 } … … 2368 2390 #undef GET_REMAINING_TIME 2369 2391 2370 LogFlowThisFunc(("Loop ended with rc=%Rrc, guestRc=%Rrc, waitRes=%ld\n", 2392 if (RT_FAILURE(guestRc)) 2393 vrc = VERR_GSTCTL_GUEST_ERROR; 2394 2395 LogFlowThisFunc(("Loop ended with rc=%Rrc, guestRc=%Rrc, waitRes=%RU32\n", 2371 2396 vrc, guestRc, waitRes)); 2372 2397 if (pGuestRc) … … 2385 2410 { 2386 2411 rc = pProcess->terminateProcess(uTimeoutMS, pGuestRc); 2387 2388 Assert(pSession);2389 int rc2 = pSession->processRemoveFromList(pProcess);2390 AssertRC(rc2);2391 2392 2412 pProcess.setNull(); 2393 2413 } -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r49389 r49504 1 2 1 /* $Id$ */ 3 2 /** @file … … 116 115 int rc2 = mSession->signalWaitEvent(aType, aEvent); 117 116 #ifdef DEBUG_andy 118 LogFlowFunc(("Signalling events of type=% ld, session=%p resulted in rc=%Rrc\n",117 LogFlowFunc(("Signalling events of type=%RU32, session=%p resulted in rc=%Rrc\n", 119 118 aType, mSession, rc2)); 120 119 #endif … … 123 122 124 123 default: 125 AssertMsgFailed(("Unhandled event % ld\n", aType));124 AssertMsgFailed(("Unhandled event %RU32\n", aType)); 126 125 break; 127 126 } … … 274 273 void GuestSession::uninit(void) 275 274 { 276 LogFlowThisFuncEnter();277 278 275 /* Enclose the state transition Ready->InUninit->NotReady. */ 279 276 AutoUninitSpan autoUninitSpan(this); … … 281 278 return; 282 279 280 LogFlowThisFuncEnter(); 281 283 282 int rc = VINF_SUCCESS; 284 283 285 284 #ifdef VBOX_WITH_GUEST_CONTROL 286 LogFlowThisFunc(("Closing directories (%RU64 total)\n", 285 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 286 287 LogFlowThisFunc(("Closing directories (%zu total)\n", 287 288 mData.mDirectories.size())); 288 289 for (SessionDirectories::iterator itDirs = mData.mDirectories.begin(); 289 290 itDirs != mData.mDirectories.end(); ++itDirs) 290 291 { 291 itDirs->second->Release(); 292 Assert(mData.mNumObjects); 293 mData.mNumObjects--; 294 itDirs->second->onRemove(); 295 itDirs->second->uninit(); 292 296 } 293 297 mData.mDirectories.clear(); 294 298 295 LogFlowThisFunc(("Closing files (% RU64total)\n",299 LogFlowThisFunc(("Closing files (%zu total)\n", 296 300 mData.mFiles.size())); 297 301 for (SessionFiles::iterator itFiles = mData.mFiles.begin(); 298 302 itFiles != mData.mFiles.end(); ++itFiles) 299 303 { 300 itFiles->second->Release(); 304 Assert(mData.mNumObjects); 305 mData.mNumObjects--; 306 itFiles->second->onRemove(); 307 itFiles->second->uninit(); 301 308 } 302 309 mData.mFiles.clear(); 303 310 304 LogFlowThisFunc(("Closing processes (% RU64total)\n",311 LogFlowThisFunc(("Closing processes (%zu total)\n", 305 312 mData.mProcesses.size())); 306 313 for (SessionProcesses::iterator itProcs = mData.mProcesses.begin(); 307 314 itProcs != mData.mProcesses.end(); ++itProcs) 308 315 { 309 itProcs->second->Release(); 316 Assert(mData.mNumObjects); 317 mData.mNumObjects--; 318 itProcs->second->onRemove(); 319 itProcs->second->uninit(); 310 320 } 311 321 mData.mProcesses.clear(); 312 322 313 LogFlowThisFunc(("mNumObjects=%RU32\n", mData.mNumObjects)); 323 AssertMsg(mData.mNumObjects == 0, 324 ("mNumObjects=%RU32 when it should be 0\n", mData.mNumObjects)); 314 325 315 326 baseUninit(); 316 317 if (!mEventSource.isNull())318 {319 mEventSource->UnregisterListener(mLocalListener);320 321 mLocalListener.setNull();322 unconst(mEventSource).setNull();323 }324 327 #endif /* VBOX_WITH_GUEST_CONTROL */ 325 328 LogFlowFuncLeaveRC(rc); … … 661 664 if (mData.mStatus != GuestSessionStatus_Started) 662 665 { 663 LogFlowThisFunc(("Session ID=%RU32 not started (anymore), status now is: % ld\n",666 LogFlowThisFunc(("Session ID=%RU32 not started (anymore), status now is: %RU32\n", 664 667 mData.mSession.mID, mData.mStatus)); 665 668 return VINF_SUCCESS; … … 721 724 { 722 725 /* Construct arguments. */ 723 if (uFlags & DirectoryCreateFlag_Parents) 724 procInfo.mArguments.push_back(Utf8Str("--parents")); /* We also want to create the parent directories. */ 726 if (uFlags) 727 { 728 if (uFlags & DirectoryCreateFlag_Parents) 729 procInfo.mArguments.push_back(Utf8Str("--parents")); /* We also want to create the parent directories. */ 730 else 731 vrc = VERR_INVALID_PARAMETER; 732 } 733 725 734 if (uMode) 726 735 { … … 780 789 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 781 790 782 for (SessionDirectories::iterator itDirs = mData.mDirectories.begin(); 783 itDirs != mData.mDirectories.end(); ++itDirs) 791 int rc = VERR_NOT_FOUND; 792 793 SessionDirectories::iterator itDirs = mData.mDirectories.begin(); 794 while (itDirs != mData.mDirectories.end()) 784 795 { 785 796 if (pDirectory == itDirs->second) 786 797 { 798 /* Make sure to consume the pointer before the one of the 799 * iterator gets released. */ 800 ComObjPtr<GuestDirectory> pDir = pDirectory; 801 787 802 Bstr strName; 788 803 HRESULT hr = itDirs->second->COMGETTER(DirectoryName)(strName.asOutParam()); … … 790 805 791 806 Assert(mData.mDirectories.size()); 792 LogFlowFunc(("Removing directory \"%s\" (Session: %RU32) (now total %ld directories)\n", 793 Utf8Str(strName).c_str(), mData.mSession.mID, mData.mDirectories.size() - 1)); 794 807 Assert(mData.mNumObjects); 808 LogFlowFunc(("Removing directory \"%s\" (Session: %RU32) (now total %zu processes, %ld objects)\n", 809 Utf8Str(strName).c_str(), mData.mSession.mID, mData.mDirectories.size() - 1, mData.mNumObjects - 1)); 810 811 rc = pDirectory->onRemove(); 795 812 mData.mDirectories.erase(itDirs); 796 return VINF_SUCCESS; 797 } 798 } 799 800 return VERR_NOT_FOUND; 813 mData.mNumObjects--; 814 815 pDir.setNull(); 816 break; 817 } 818 819 itDirs++; 820 } 821 822 LogFlowFuncLeaveRC(rc); 823 return rc; 801 824 } 802 825 … … 1171 1194 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1172 1195 1173 for (SessionFiles::iterator itFiles = mData.mFiles.begin(); 1174 itFiles != mData.mFiles.end(); ++itFiles) 1196 int rc = VERR_NOT_FOUND; 1197 1198 SessionFiles::iterator itFiles = mData.mFiles.begin(); 1199 while (itFiles != mData.mFiles.end()) 1175 1200 { 1176 1201 if (pFile == itFiles->second) … … 1188 1213 Utf8Str(strName).c_str(), mData.mSession.mID, mData.mFiles.size() - 1, mData.mNumObjects - 1)); 1189 1214 1190 pFile->cancelWaitEvents(); 1191 pFile->Release(); 1192 1215 rc = pFile->onRemove(); 1193 1216 mData.mFiles.erase(itFiles); 1194 1217 mData.mNumObjects--; … … 1198 1221 fireGuestFileRegisteredEvent(mEventSource, this, pCurFile, 1199 1222 false /* Unregistered */); 1200 return VINF_SUCCESS; 1201 } 1202 } 1203 1204 return VERR_NOT_FOUND; 1223 pCurFile.setNull(); 1224 break; 1225 } 1226 1227 itFiles++; 1228 } 1229 1230 LogFlowFuncLeaveRC(rc); 1231 return rc; 1205 1232 } 1206 1233 … … 1485 1512 1486 1513 return S_OK; 1514 } 1515 1516 /** 1517 * Called by IGuest right before this session gets removed from 1518 * the public session list. 1519 */ 1520 int GuestSession::onRemove(void) 1521 { 1522 LogFlowThisFuncEnter(); 1523 1524 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1525 1526 int vrc = VINF_SUCCESS; 1527 1528 /* 1529 * Note: The event source stuff holds references to this object, 1530 * so make sure that this is cleaned up *before* calling uninit. 1531 */ 1532 if (!mEventSource.isNull()) 1533 { 1534 mEventSource->UnregisterListener(mLocalListener); 1535 1536 mLocalListener.setNull(); 1537 unconst(mEventSource).setNull(); 1538 } 1539 1540 LogFlowFuncLeaveRC(vrc); 1541 return vrc; 1487 1542 } 1488 1543 … … 1756 1811 ComAssertComRC(hr); 1757 1812 1758 LogFlowFunc((" Closing process (PID=%RU32) ...\n", uPID));1813 LogFlowFunc(("Removing process (PID=%RU32) ...\n", uPID)); 1759 1814 1760 1815 SessionProcesses::iterator itProcs = mData.mProcesses.begin(); … … 1763 1818 if (pProcess == itProcs->second) 1764 1819 { 1765 /* Make sure to consume the pointer before the one of thfe 1820 #ifdef DEBUG_andy 1821 ULONG cRefs = pProcess->AddRef(); 1822 Assert(cRefs >= 2); 1823 LogFlowFunc(("pProcess=%p, cRefs=%RU32\n", pProcess, cRefs - 1)); 1824 pProcess->Release(); 1825 #endif 1826 /* Make sure to consume the pointer before the one of the 1766 1827 * iterator gets released. */ 1767 ComObjPtr<GuestProcess> p CurProcess= pProcess;1768 1769 hr = p CurProcess->COMGETTER(PID)(&uPID);1828 ComObjPtr<GuestProcess> pProc = pProcess; 1829 1830 hr = pProc->COMGETTER(PID)(&uPID); 1770 1831 ComAssertComRC(hr); 1771 1832 1833 Assert(mData.mProcesses.size()); 1772 1834 Assert(mData.mNumObjects); 1773 LogFlowFunc(("Removing process ID=%RU32 (Session: %RU32), guest PID=%RU32 (now total % ld processes, %ldobjects)\n",1835 LogFlowFunc(("Removing process ID=%RU32 (Session: %RU32), guest PID=%RU32 (now total %zu processes, %RU32 objects)\n", 1774 1836 pProcess->getObjectID(), mData.mSession.mID, uPID, mData.mProcesses.size() - 1, mData.mNumObjects - 1)); 1775 1837 1776 pProcess->cancelWaitEvents(); 1777 pProcess->Release(); 1778 1838 rc = pProcess->onRemove(); 1779 1839 mData.mProcesses.erase(itProcs); 1780 1840 mData.mNumObjects--; … … 1782 1842 alock.release(); /* Release lock before firing off event. */ 1783 1843 1784 fireGuestProcessRegisteredEvent(mEventSource, this /* Session */, p CurProcess,1844 fireGuestProcessRegisteredEvent(mEventSource, this /* Session */, pProc, 1785 1845 uPID, false /* Process unregistered */); 1786 rc = VINF_SUCCESS;1846 pProc.setNull(); 1787 1847 break; 1788 1848 } … … 1900 1960 Assert(mData.mNumObjects <= VBOX_GUESTCTRL_MAX_OBJECTS); 1901 1961 1902 LogFlowFunc(("Added new process (Session: %RU32) with process ID=%RU32 (now total % ldprocesses, %ld objects)\n",1962 LogFlowFunc(("Added new process (Session: %RU32) with process ID=%RU32 (now total %zu processes, %ld objects)\n", 1903 1963 mData.mSession.mID, uNewProcessID, mData.mProcesses.size(), mData.mNumObjects)); 1964 1965 alock.release(); /* Release lock before firing off event. */ 1904 1966 1905 1967 fireGuestProcessRegisteredEvent(mEventSource, this /* Session */, pProcess, … … 1993 2055 int GuestSession::setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc) 1994 2056 { 1995 LogFlowThisFunc(("oldStatus=% ld, newStatus=%ld, sessionRc=%Rrc\n",2057 LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, sessionRc=%Rrc\n", 1996 2058 mData.mStatus, sessionStatus, sessionRc)); 1997 2059 … … 2178 2240 2179 2241 default: 2180 AssertMsgFailed(("Unhandled session status % ld\n", mData.mStatus));2242 AssertMsgFailed(("Unhandled session status %RU32\n", mData.mStatus)); 2181 2243 return VERR_NOT_IMPLEMENTED; 2182 2244 } … … 2208 2270 2209 2271 default: 2210 AssertMsgFailed(("Unhandled session status % ld\n", mData.mStatus));2272 AssertMsgFailed(("Unhandled session status %RU32\n", mData.mStatus)); 2211 2273 return VERR_NOT_IMPLEMENTED; 2212 2274 } 2213 2275 } 2214 2276 2215 LogFlowThisFunc(("sessionStatus=% ld, sessionRc=%Rrc, waitResult=%ld\n",2277 LogFlowThisFunc(("sessionStatus=%RU32, sessionRc=%Rrc, waitResult=%RU32\n", 2216 2278 mData.mStatus, mData.mRC, waitResult)); 2217 2279 … … 2318 2380 *pGuestRc = (int)lGuestRc; 2319 2381 2320 LogFlowThisFunc(("Status changed event for session ID=%RU32, new status is: % ld(%Rrc)\n",2382 LogFlowThisFunc(("Status changed event for session ID=%RU32, new status is: %RU32 (%Rrc)\n", 2321 2383 mData.mSession.mID, sessionStatus, 2322 2384 RT_SUCCESS((int)lGuestRc) ? VINF_SUCCESS : (int)lGuestRc)); … … 2520 2582 { 2521 2583 case VERR_GSTCTL_GUEST_ERROR: 2522 hr = GuestProcess::setErrorExternal(this, guestRc); 2584 /** @todo Handle VERR_NOT_EQUAL (meaning process exit code <> 0). */ 2585 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Could not create directory")); 2523 2586 break; 2524 2587 … … 2529 2592 case VERR_BROKEN_PIPE: 2530 2593 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Unexpectedly aborted")); 2531 break;2532 2533 case VERR_CANT_CREATE:2534 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Could not create directory"));2535 2594 break; 2536 2595
Note:
See TracChangeset
for help on using the changeset viewer.