ok, understood that piece of code. It was correct.
The reason multiple tray icons appear is due to an error in mActive field of
VBoxTrayIcon, needs to be initialized to false inside VBoxTrayIcon constructor
VBoxTrayIcon::VBoxTrayIcon (VBoxSelectorWnd* aParent, UIVMItemModel* aVMModel)
{
mParent = aParent;
mVMModel = aVMModel;
mActive = false; <====== NEED TO ADD THIS
}
--- On Fri, 7/30/10, Huihong Luo <[email protected]> wrote:
From: Huihong Luo <[email protected]>
Subject: [vbox-dev] Help me understanding the following code segment
(VBoxGlobal::trayIconInstall())
To: [email protected]
Date: Friday, July 30, 2010, 10:09 AM
I am having trouble understanding the following code about mVBox.SetExtraData
to "0". How does this check whether tray icon died? shouldn't if (mVBox.isOk())
be if ( ! mVBox.isOk()) ?
This cleans up the tray winid, and will make TrayIcon not singleton.
bool VBoxGlobal::trayIconInstall()
{
int rc = 0;
QString strTrayWinID = mVBox.GetExtraData (VBoxDefs::GUI_TrayIconWinID);
if (false == strTrayWinID.isEmpty())
{
/* Check if current tray icon is alive by writing some bogus value. */
mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, "0");
if (mVBox.isOk())
{
/* Current tray icon died - clean up. */
mVBox.SetExtraData (VBoxDefs::GUI_TrayIconWinID, NULL);
strTrayWinID.clear();
}
}
-----Inline Attachment Follows-----
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev