- Timestamp:
- Aug 27, 2018 8:23:53 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r73901 r73903 814 814 BstrFmt(tr("Export appliance '%s'"), aLocInfo.strPath.c_str()), 815 815 (aLocInfo.storageType == VFSType_File) ? WriteFile : WriteS3); 816 if (FAILED(rc)) 817 return rc; 816 818 817 819 /* Initialize our worker task */ … … 823 825 catch(...) 824 826 { 825 delete task;826 827 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 827 828 tr("Could not create TaskOVF object for for writing out the OVF to disk")); … … 882 883 BstrFmt(tr("Export appliance to Cloud '%s'"), aLocInfo.strPath.c_str()), 883 884 mode); 885 if (FAILED(rc)) 886 return rc; 884 887 885 888 // Initialize our worker task … … 891 894 catch(...) 892 895 { 893 delete task;894 896 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 895 897 tr("Could not create TaskOCI object for exporting to OCI")); … … 912 914 HRESULT rc; 913 915 RT_NOREF(aFormat); 914 try /** @todo r=bird: This try..catch(HRESULT) stuff here totally messes up anyones 915 * understanding of what i_setUpProgress and createThread() might throw. You really 916 * think that they must throw some 'HRESULT' stuff too, right. Otherwise, why would 917 * anyone put their invocations inside these try..catch statements? But the, WTF 918 * do they return status codes? ARRRRRRRRRRRRRRG! 919 * 920 * Please rewrite this and all similar places to use nested if (SUCCEEDED(hrc)) rather 921 * than unmaintainable code like this. 922 */ 916 try 923 917 { 924 918 rc = i_setUpProgress(aProgress, 925 919 BstrFmt(tr("Export appliance '%s'"), aLocInfo.strPath.c_str()), 926 920 (aLocInfo.storageType == VFSType_File) ? WriteFile : WriteS3); 927 /** @todo r=bird: You ignore the status code here... You can simply return if this fails, because 928 * you don't have any state to clean up. */921 if (FAILED(rc)) 922 return rc; 929 923 930 924 /* Initialize our worker task */ … … 936 930 catch(...) 937 931 { 938 /** @todo r=bird: Task will always be NULL here. Why? Because the assignment of 'task' is939 * the very last thing that happens above. Traditionally, when you 'delete (TaskOPC *)NULL'940 * the CRT kills your process. (On windows, though, this may differ depending on whether we're941 * executing this in a COM worker thread or a IPRT/main worker thread. We may survive in the942 * former, but not the latter.)943 *944 * P.S. Please make your editor strip trailing spaces on lines you've modified.945 */946 delete task;947 932 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 948 933 tr("Could not create TaskOPC object for for writing out the OPC to disk"));
Note:
See TracChangeset
for help on using the changeset viewer.