VirtualBox

Changeset 2057 in vbox for trunk


Ignore:
Timestamp:
Apr 12, 2007 5:16:37 PM (18 years ago)
Author:
vboxsync
Message:

Main: Removed erroneous extra Release() in auto-shutdown management that caused segfaults when manually stopping the server for whatever reason.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/linux/server.cpp

    r1882 r2057  
    246246                gEventQ->IsOnCurrentThread (&onMainThread);
    247247
    248             LogFlowFunc (("Last VirtualBox instance was released, "
    249                           "scheduling server shutdown in %d ms...\n",
    250                           VBoxSVC_ShutdownDelay));
    251 
    252             int vrc = RTTimerStart (sTimer, uint64_t (VBoxSVC_ShutdownDelay) * 1000000);
    253             AssertRC (vrc);
    254             if (VBOX_FAILURE (vrc))
     248            PRBool timerStarted = PR_FALSE;
     249
     250            /* sTimes is null if this call originates from
     251             * FactoryDestructor() */
     252            if (sTimer != NULL)
    255253            {
    256                 /* Failed to start the timer, post the shutdown event
    257                  * manually if not on the main thread alreay. */
     254                LogFlowFunc (("Last VirtualBox instance was released, "
     255                              "scheduling server shutdown in %d ms...\n",
     256                              VBoxSVC_ShutdownDelay));
     257
     258                int vrc = RTTimerStart (sTimer, uint64_t (VBoxSVC_ShutdownDelay) * 1000000);
     259                AssertRC (vrc);
     260                timerStarted = SUCCEEDED (vrc);
     261            }
     262            else
     263            {
     264                LogFlowFunc (("Last VirtualBox instance was released "
     265                              "on XPCOM shutdown.\n"));
     266                Assert (onMainThread);
     267            }
     268
     269            if (!timerStarted)
     270            {
    258271                if (!onMainThread)
    259272                {
     273                    /* Failed to start the timer, post the shutdown event
     274                     * manually if not on the main thread alreay. */
    260275                    ShutdownTimer (NULL, NULL);
    261276                }
     
    273288                     *    client was faster and requested VirtualBox again.
    274289                     *
    275                      * In either case, since we're on the main thread already,
    276                      * it's necessary just to release the instance once more
    277                      * to call its destructor.
     290                     * In either case, there is nothing to do.
     291                     *
     292                     * Note: case b) is actually no more valid since we don't
     293                     * call Release() from DestructEventHandler() in this case
     294                     * any more. Thus, we assert below.
    278295                     */
    279                     count = VirtualBox::Release();
     296
     297                    Assert (gEventQ == NULL);
    280298                }
    281299            }
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