VirtualBox

Changeset 3909 in vbox


Ignore:
Timestamp:
Jul 27, 2007 5:09:06 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt: Delete VBoxEnumerateMediaEvents referencing COM objects from the message queue before uninitializing COM (to avoid crashes inside system DLLs on Win32).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r3867 r3909  
    498498////////////////////////////////////////////////////////////////////////////////
    499499
    500 static bool vboxGlobal_inited = false;
    501 static bool vboxGlobal_cleanup = false;
     500static bool sVBoxGlobalInited = false;
     501static bool sVBoxGlobalInCleanup = false;
    502502
    503503/** @internal
     
    510510static void vboxGlobalCleanup()
    511511{
    512     Assert (!vboxGlobal_cleanup);
    513     vboxGlobal_cleanup = true;
     512    Assert (!sVBoxGlobalInCleanup);
     513    sVBoxGlobalInCleanup = true;
    514514    vboxGlobal().cleanup();
    515515}
     
    626626    static VBoxGlobal vboxGlobal_instance;
    627627
    628     if (!vboxGlobal_inited)
     628    if (!sVBoxGlobalInited)
    629629    {
    630630        /* check that a QApplication instance is created */
    631631        if (qApp)
    632632        {
    633             vboxGlobal_inited = true;
     633            sVBoxGlobalInited = true;
    634634            vboxGlobal_instance.init();
    635635            /* add our cleanup handler to the list of Qt post routines */
     
    14491449
    14501450    /* ignore the request during application termination */
    1451     if (vboxGlobal_cleanup)
     1451    if (sVBoxGlobalInCleanup)
    14521452        return;
    14531453
     
    14871487            VBoxMediaList::const_iterator it;
    14881488            for (it = mList.begin();
    1489                  it != mList.end() && !vboxGlobal_cleanup;
     1489                 it != mList.end() && !sVBoxGlobalInCleanup;
    14901490                 ++ it, ++ index)
    14911491            {
     
    15511551
    15521552            /* post the last message to indicate the end of enumeration */
    1553             if (!vboxGlobal_cleanup)
     1553            if (!sVBoxGlobalInCleanup)
    15541554                QApplication::postEvent (target, new VBoxEnumerateMediaEvent());
    15551555
     
    34043404{
    34053405    /* sanity check */
    3406     if (!vboxGlobal_cleanup)
     3406    if (!sVBoxGlobalInCleanup)
    34073407    {
    34083408        AssertMsgFailed (("Should never be called directly\n"));
     
    34193419    if (media_enum_thread)
    34203420    {
    3421         /* vboxGlobal_cleanup is true here, so just wait for the thread */
     3421        /* sVBoxGlobalInCleanup is true here, so just wait for the thread */
    34223422        media_enum_thread->wait();
    34233423        delete media_enum_thread;
     
    34363436    /* the last step to ensure we don't use COM any more */
    34373437    vbox.detach();
     3438
     3439    /* There may be VBoxEnumerateMediaEvent instances still in the message
     3440     * queue which reference COM objects. Remove them to release those objects
     3441     * before uninitializing the COM subsystem. */
     3442    QApplication::removePostedEvents (this);
    34383443
    34393444    COMBase::cleanupCOM();
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