VirtualBox

Ignore:
Timestamp:
May 25, 2019 8:59:23 PM (6 years ago)
Author:
vboxsync
Message:

Console::i_vmstateChangeCallback/VMSTATE_OFF: Same delete NULL scenario as previously, but now with uncaught HRESULT throws on EMT thrown, as it were, into the mix. We should really forbid throwing stuff in Main, it is _clearly_ too difficult to get simple things like this half right.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r78751 r78752  
    88468846                that->i_setMachineStateLocally(MachineState_Stopping);
    88478847
    8848                 /* Setup task object and thread to carry out the operation
     8848                /*
     8849                 * Setup task object and thread to carry out the operation
    88498850                 * asynchronously (if we call powerDown() right here but there
    88508851                 * is one or more mpUVM callers (added with addVMCaller()) we'll
    8851                  * deadlock). */
     8852                 * deadlock).
     8853                 */
    88528854                VMPowerDownTask *task = NULL;
    88538855                try
    88548856                {
    88558857                    task = new VMPowerDownTask(that, pProgress);
    8856                      /* If creating a task failed, this can currently mean one of
    8857                       * two: either Console::uninit() has been called just a ms
    8858                       * before (so a powerDown() call is already on the way), or
    8859                       * powerDown() itself is being already executed. Just do
    8860                       * nothing.
    8861                       */
    8862                     if (!task->isOk())
    8863                     {
    8864                         LogFlowFunc(("Console is already being uninitialized. \n"));
    8865                         throw E_FAIL;
    8866                     }
    88678858                }
    8868                 catch(...)
     8859                catch (std::bad_alloc &)
    88698860                {
     8861                    LogRelFunc(("E_OUTOFMEMORY creating VMPowerDownTask"));
     8862                    rc = E_OUTOFMEMORY;
     8863                    break;
     8864                }
     8865
     8866                /*
     8867                 * If creating a task failed, this can currently mean one of
     8868                 * two: either Console::uninit() has been called just a ms
     8869                 * before (so a powerDown() call is already on the way), or
     8870                 * powerDown() itself is being already executed. Just do
     8871                 * nothing.
     8872                 */
     8873                if (!task->isOk())
     8874                {
     8875                    rc = task->createThread();
     8876                    task = NULL;
     8877                    if (FAILED(rc))
     8878                        LogRelFunc(("Problem with creating thread for VMPowerDownTask.\n"));
     8879                }
     8880                else
     8881                {
     8882                    LogFlowFunc(("Console is already being uninitialized. (%Rhrc)\n", task->rc()));
    88708883                    delete task;
    8871                     LogFlowFunc(("Problem with creating VMPowerDownTask object. \n"));
     8884                    rc = E_FAIL;
    88728885                }
    8873 
    8874                 rc = task->createThread();
    8875 
    8876                 if (FAILED(rc))
    8877                 {
    8878                     LogFlowFunc(("Problem with creating thread for VMPowerDownTask. \n"));
    8879                 }
    8880 
    88818886            }
    88828887            break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette