VirtualBox

Changeset 15610 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 16, 2008 10:01:58 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: Make sure the settings files are checked for the auto-conversion really before other code gets any chance to unconditionally save them w/o backing up.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r15304 r15610  
    10511051
    10521052#ifdef VBOX_GUI_WITH_SYSTRAY
    1053     bool mIsTrayMenu;           /* Tray icon active/desired? */
     1053    bool mIsTrayMenu : 1; /*< Tray icon active/desired? */
     1054    bool mIncreasedWindowCounter : 1;
    10541055#endif
     1056
    10551057    QThread *mMediaEnumThread;
    10561058    VBoxMediaList mMediaList;
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r15586 r15610  
    12561256#ifdef VBOX_GUI_WITH_SYSTRAY
    12571257    , mIsTrayMenu (false)
     1258    , mIncreasedWindowCounter (false)
    12581259#endif
    12591260    , mMediaEnumThread (NULL)
     
    53055306    }
    53065307
     5308    /* create default non-null global settings */
     5309    gset = VBoxGlobalSettings (false);
     5310
     5311    /* try to load global settings */
     5312    gset.load (mVBox);
     5313    if (!mVBox.isOk() || !gset)
     5314    {
     5315        vboxProblem().cannotLoadGlobalConfig (mVBox, gset.lastError());
     5316        return;
     5317    }
     5318
     5319    /* Load the customized language as early as possible to get possible error
     5320     * messages translated */
     5321    QString languageId = gset.languageId();
     5322    if (!languageId.isNull())
     5323        loadLanguage (languageId);
     5324
     5325    retranslateUi();
     5326
     5327    /* Note: the settings conversion check must be done before anything else
     5328     * that may unconditionally overwrite settings files in the new format (like
     5329     * SetExtraData()). But after loading the proper the language. */
     5330    if (!checkForAutoConvertedSettings())
     5331        return;
     5332
    53075333#ifdef VBOX_GUI_WITH_SYSTRAY
    5308     /* Increase open Fe/Qt4 windows reference count. */
    5309     int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() + 1;
    5310     AssertMsg ((c>=0) || (mVBox.isOk()),
    5311         ("Something went wrong with the window reference count!"));
    5312     mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount, QString ("%1").arg (c));
     5334    {
     5335        /* Increase open Fe/Qt4 windows reference count. */
     5336        int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() + 1;
     5337        AssertMsgReturnVoid ((c >= 0) || (mVBox.isOk()),
     5338            ("Something went wrong with the window reference count!"));
     5339        mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount, QString ("%1").arg (c));
     5340        mIncreasedWindowCounter = mVBox.isOk();
     5341        AssertReturnVoid (mIncreasedWindowCounter);
     5342    }
    53135343#endif
    53145344
     
    54675497    qApp->installEventFilter (this);
    54685498
    5469     /* create default non-null global settings */
    5470     gset = VBoxGlobalSettings (false);
    5471 
    5472     /* try to load global settings */
    5473     gset.load (mVBox);
    5474     if (!mVBox.isOk() || !gset)
    5475     {
    5476         vboxProblem().cannotLoadGlobalConfig (mVBox, gset.lastError());
    5477         return;
    5478     }
    5479 
    5480     /* Load customized language if any */
    5481     QString languageId = gset.languageId();
    5482     if (!languageId.isNull())
    5483         loadLanguage (languageId);
    5484 
    5485     retranslateUi();
    5486 
    54875499    /* process command line */
    54885500
     
    56015613    }
    56025614
     5615#ifdef VBOX_GUI_WITH_SYSTRAY
     5616    if (mIncreasedWindowCounter)
     5617    {
     5618        /* Decrease open Fe/Qt4 windows reference count. */
     5619        int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() - 1;
     5620        AssertMsg ((c >= 0) || (mVBox.isOk()),
     5621            ("Something went wrong with the window reference count!"));
     5622        if (c < 0)
     5623            c = 0;   /* Clean up the mess. */
     5624        mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount,
     5625                            (c > 0) ? QString ("%1").arg (c) : NULL);
     5626        AssertWrapperOk (mVBox);
     5627        if (c == 0)
     5628        {
     5629            mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, NULL);
     5630            AssertWrapperOk (mVBox);
     5631        }
     5632    }
     5633#endif
     5634
    56035635    if (!callback.isNull())
    56045636    {
     
    56255657    if (mSelectorWnd)
    56265658        delete mSelectorWnd;
    5627 
    5628 #ifdef VBOX_GUI_WITH_SYSTRAY
    5629     /* Decrease open Fe/Qt4 windows reference count. */
    5630     int c = mVBox.GetExtraData (VBoxDefs::GUI_MainWindowCount).toInt() - 1;
    5631     AssertMsg ((c>=0) || (mVBox.isOk()),
    5632         ("Something went wrong with the window reference count!"));
    5633     if (c < 0)
    5634         c = 0;   /* Clean up the mess. */
    5635     mVBox.SetExtraData (VBoxDefs::GUI_MainWindowCount, (c > 0) ? QString ("%1").arg (c) : NULL);
    5636     if (c == 0)
    5637         mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, NULL);
    5638 #endif
    56395659
    56405660    /* ensure CGuestOSType objects are no longer used */
  • trunk/src/VBox/Frontends/VirtualBox4/src/main.cpp

    r15474 r15610  
    346346                break;
    347347
    348             /* Note: the settings conversion check must be done before
    349              * anything else that can unconditionally overwrite settings files
    350              * int he new format (like the license thingy below) */
    351             if (!vboxGlobal().checkForAutoConvertedSettings())
    352                 break;
    353 
    354348#ifndef VBOX_OSE
    355349#ifdef Q_WS_X11
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