Changeset 6375 in vbox
- Timestamp:
- Jan 18, 2008 1:54:23 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 27317
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r6367 r6375 168 168 169 169 const ComObjPtr <Progress> mProgress; 170 171 Utf8Str mErrorMsg; 170 172 }; 171 173 … … 5329 5331 * VM error callback function. Called by the various VM components. 5330 5332 * 5331 * @param pVM TheVM handle. Can be NULL if an error occurred before5332 * 5333 * @param pVM VM handle. Can be NULL if an error occurred before 5334 * successfully creating a VM. 5333 5335 * @param pvUser Pointer to the VMProgressTask structure. 5334 5336 * @param rc VBox status code. 5335 * @param pszFormat The error message. 5336 * @thread EMT. 5337 * @param pszFormat Printf-like error message. 5338 * @param args Various number of argumens for the error message. 5339 * 5340 * @thread EMT, VMPowerUp... 5341 * 5342 * @note The VMProgressTask structure modified by this callback is not thread 5343 * safe. 5337 5344 */ 5338 5345 /* static */ DECLCALLBACK (void) … … 5346 5353 va_list va2; 5347 5354 va_copy(va2, args); /* Have to make a copy here or GCC will break. */ 5348 HRESULT hrc = setError (E_FAIL, tr ("%N.\n" 5349 "VBox status code: %d (%Vrc)"), 5350 tr (pszFormat), &va2, 5351 rc, rc); 5352 task->mProgress->notifyComplete (hrc); 5355 Utf8Str errorMsg = Utf8StrFmt (tr ("%N.\n" 5356 "VBox status code: %d (%Vrc)"), 5357 pszFormat, &va2, rc, rc); 5353 5358 va_end(va2); 5359 5360 /* For now, this may be called only once. Ignore subsequent calls. */ 5361 AssertMsgReturnVoid (task->mErrorMsg.isNull(), 5362 ("Cannot set error to '%s': it is already set to '%s'", 5363 errorMsg.raw(), task->mErrorMsg.raw())); 5364 5365 task->mErrorMsg = errorMsg; 5354 5366 } 5355 5367 … … 5919 5931 ErrorInfoKeeper eik; 5920 5932 5921 /* 5922 * powerDown() will call VMR3Destroy() and do all necessary 5923 * cleanup (VRDP, USB devices) 5924 */ 5933 /* powerDown() will call VMR3Destroy() and do all necessary 5934 * cleanup (VRDP, USB devices) */ 5925 5935 HRESULT hrc2 = console->powerDown(); 5926 5936 AssertComRC (hrc2); … … 5937 5947 if (SUCCEEDED (hrc) && VBOX_FAILURE (vrc)) 5938 5948 { 5939 /* 5940 * If VMR3Create() or one of the other calls in this function fail, 5941 * an appropriate error message has been already set. However since 5942 * that happens via a callback, the status code in this function is 5943 * not updated. 5949 /* If VMR3Create() or one of the other calls in this function fail, 5950 * an appropriate error message has been set in task->mErrorMsg. 5951 * However since that happens via a callback, the hrc status code in 5952 * this function is not updated. 5944 5953 */ 5945 if ( !task->mProgress->completed())5954 if (task->mErrorMsg.isNull()) 5946 5955 { 5947 /* 5948 * If the COM error info is not yet set but we've got a 5949 * failure, convert the VBox status code into a meaningful 5950 * error message. This becomes unused once all the sources of 5951 * errors set the appropriate error message themselves. 5952 * Note that we don't use VMSetError() below because pVM is 5953 * either invalid or NULL here. 5956 /* If the error message is not set but we've got a failure, 5957 * convert the VBox status code into a meaningfulerror message. 5958 * This becomes unused once all the sources of errors set the 5959 * appropriate error message themselves. 5954 5960 */ 5955 5961 AssertMsgFailed (("Missing error message during powerup for " 5956 5962 "status code %Vrc\n", vrc)); 5957 hrc = setError (E_FAIL,5963 task->mErrorMsg = Utf8StrFmt ( 5958 5964 tr ("Failed to start VM execution (%Vrc)"), vrc); 5959 5965 } 5960 else 5961 hrc = task->mProgress->resultCode();5962 5963 Assert (FAILED (hrc));5966 5967 /* Set the error message as the COM error. 5968 * Progress::notifyComplete() will pick it up later. */ 5969 hrc = setError (E_FAIL, task->mErrorMsg); 5964 5970 break; 5965 5971 } … … 5970 5976 console->mMachineState == MachineState_Restoring) 5971 5977 { 5972 /* 5973 * We are still in the Starting/Restoring state. This means one of: 5974 * 1) we failed before VMR3Create() was called; 5975 * 2) VMR3Create() failed. 5976 * In both cases, there is no need to call powerDown(), but we still 5977 * need to go back to the PoweredOff/Saved state. Reuse 5978 * vmstateChangeCallback() for that purpose. 5978 /* We are still in the Starting/Restoring state. This means one of: 5979 * 5980 * 1) we failed before VMR3Create() was called; 5981 * 2) VMR3Create() failed. 5982 * 5983 * In both cases, there is no need to call powerDown(), but we still 5984 * need to go back to the PoweredOff/Saved state. Reuse 5985 * vmstateChangeCallback() for that purpose. 5979 5986 */ 5980 5987 … … 5988 5995 5989 5996 /* 5990 * Evaluate the final result. 5991 * Note that the appropriate mMachineState value is already set by 5992 * vmstateChangeCallback() in all cases. 5997 * Evaluate the final result. Note that the appropriate mMachineState value 5998 * is already set by vmstateChangeCallback() in all cases. 5993 5999 */ 5994 6000 … … 6003 6009 else 6004 6010 { 6005 if (!task->mProgress->completed()) 6006 { 6007 /* The progress object will fetch the current error info. This 6008 * gets the errors signalled by using setError(). The ones 6009 * signalled via VMSetError() immediately notify the progress 6010 * object that the operation is completed. */ 6011 task->mProgress->notifyComplete (hrc); 6012 } 6011 /* The progress object will fetch the current error info */ 6012 task->mProgress->notifyComplete (hrc); 6013 6013 6014 6014 LogRel (("Power up failed (vrc=%Vrc, hrc=0x%08X)\n", vrc, hrc)); -
trunk/src/VBox/Main/ProgressImpl.cpp
r5999 r6375 747 747 * If the result code indicates a success (|SUCCEEDED (@a aResultCode)|) 748 748 * then the current operation is set to the last 749 * 750 * Note that this method may be called only once for the given Progress object. 751 * Subsequent calls will assert. 749 752 * 750 753 * @param aResultCode Operation result code … … 754 757 AutoLock lock (this); 755 758 AssertReturn (isReady(), E_FAIL); 759 760 AssertReturn (mCompleted == FALSE, E_FAIL); 756 761 757 762 mCompleted = TRUE; -
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r5999 r6375 233 233 } 234 234 } 235 236 /**237 * Sets the given error info object for the current thread. If @a aPreserve238 * is @c true, then the current error info set on the thread before this239 * method is called will be preserved in the IVirtualBoxErrorInfo::next240 * attribute of the new error info object that will be then set as the241 * current error info object.242 */243 244 //static245 HRESULT setError (IVirtualBoxErrorInfo *aInfo);246 235 247 236 // ProgressErrorInfo class
Note:
See TracChangeset
for help on using the changeset viewer.