Changeset 97626 in vbox
- Timestamp:
- Nov 21, 2022 1:34:53 PM (2 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestFileImpl.h
r96407 r97626 93 93 /** @} */ 94 94 95 p rivate:95 public: 96 96 97 97 /** @name Wrapped IGuestFile properties. … … 135 135 /** @} */ 136 136 137 private: 138 137 139 /** This can safely be used without holding any locks. 138 140 * An AutoCaller suffices to prevent it being destroy while in use and -
trunk/src/VBox/Main/include/GuestSessionImplTasks.h
r97540 r97626 243 243 /** @name File handling primitives. 244 244 * @{ */ 245 int fileClose(const ComObjPtr<GuestFile> &file); 245 246 int fileCopyFromGuestInner(const Utf8Str &strSrcFile, ComObjPtr<GuestFile> &srcFile, 246 247 const Utf8Str &strDstFile, PRTFILE phDstFile, -
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r97610 r97626 384 384 385 385 /** 386 * Closes the file on the guest side .386 * Closes the file on the guest side and unregisters it. 387 387 * 388 388 * @returns VBox status code. … … 424 424 NULL /* FileStatus */, prcGuest); 425 425 unregisterWaitEvent(pEvent); 426 427 /* Unregister the file object from the guest session. */ 428 AssertPtr(mSession); 429 int vrc2 = mSession->i_fileUnregister(this); 430 if (RT_SUCCESS(vrc)) 431 vrc = vrc2; 426 432 427 433 LogFlowFuncLeaveRC(vrc); … … 1535 1541 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 1536 1542 int vrc = i_closeFile(&vrcGuest); 1537 /* On failure don't return here, instead do all the cleanup1538 * work first and then return an error. */1539 1540 AssertPtr(mSession);1541 int vrc2 = mSession->i_fileUnregister(this);1542 if (RT_SUCCESS(vrc))1543 vrc = vrc2;1544 1545 1543 if (RT_FAILURE(vrc)) 1546 1544 { -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r97592 r97626 494 494 495 495 /** 496 * Closes a formerly opened guest file. 497 * 498 * @returns VBox status code. 499 * @param file Guest file to close. 500 * 501 * @note Set a progress error message on error. 502 */ 503 int GuestSessionTask::fileClose(const ComObjPtr<GuestFile> &file) 504 { 505 int vrcGuest; 506 int vrc = file->i_closeFile(&vrcGuest); 507 if (RT_FAILURE(vrc)) 508 { 509 Utf8Str strFilename; 510 HRESULT const hrc = file->getFilename(strFilename); 511 AssertComRCReturn(hrc, VERR_OBJECT_DESTROYED); 512 setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(tr("Error closing guest file \"%s\": %Rrc"), 513 strFilename.c_str(), vrc == VERR_GSTCTL_GUEST_ERROR ? vrcGuest : vrc)); 514 if (RT_SUCCESS(vrc)) 515 vrc = vrc == VERR_GSTCTL_GUEST_ERROR ? vrcGuest : vrc; 516 } 517 518 return vrc; 519 } 520 521 /** 496 522 * Copies a file from the guest to the host. 497 523 * … … 613 639 if (fSkip) 614 640 { 615 int vrc2 = srcFile->i_closeFile(&vrcGuest); 616 AssertRC(vrc2); 641 int vrc2 = fileClose(srcFile); 642 if (RT_SUCCESS(vrc)) 643 vrc = vrc2; 644 617 645 return vrc; 618 646 } … … 674 702 } 675 703 676 int vrc2 = srcFile->i_closeFile(&vrcGuest); 677 AssertRC(vrc2); 704 int vrc2 = fileClose(srcFile); 705 if (RT_SUCCESS(vrc)) 706 vrc = vrc2; 678 707 679 708 LogFlowFuncLeaveRC(vrc); … … 914 943 if (fSkip) 915 944 { 916 int vrc2 = dstFile->i_closeFile(&vrcGuest); 917 AssertRC(vrc2); 945 int vrc2 = fileClose(dstFile); 946 if (RT_SUCCESS(vrc)) 947 vrc = vrc2; 948 918 949 return vrc; 919 950 } … … 942 973 } 943 974 944 int vrc2 = dstFile->i_closeFile(&vrcGuest); 945 AssertRC(vrc2); 975 int vrc2 = fileClose(dstFile); 976 if (RT_SUCCESS(vrc)) 977 vrc = vrc2; 946 978 947 979 LogFlowFuncLeaveRC(vrc); … … 2564 2596 vrc = fileCopyToGuestInner(strFileSrc, hVfsFile, strFileDst, dstFile, FileCopyFlag_None, 0 /*offCopy*/, cbSrcSize); 2565 2597 2566 int vrc2 = dstFile->i_closeFile(&vrcGuest); 2567 AssertRC(vrc2); 2598 int vrc2 = fileClose(dstFile); 2599 if (RT_SUCCESS(vrc)) 2600 vrc = vrc2; 2568 2601 } 2569 2602 }
Note:
See TracChangeset
for help on using the changeset viewer.