[vbox-dev] Help me understanding the following code segment (VBoxGlobal::trayIconInstall())

Huihong Luo huisinro at yahoo.com
Fri Jul 30 16:05:05 PDT 2010

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 <huisinro at yahoo.com> wrote:

From: Huihong Luo <huisinro at yahoo.com>
Subject: [vbox-dev] Help me understanding the following code segment (VBoxGlobal::trayIconInstall())
To: vbox-dev at virtualbox.org
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);
-----Inline Attachment Follows-----

vbox-dev mailing list
vbox-dev at virtualbox.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20100730/f2d7d996/attachment-0001.html 

More information about the vbox-dev mailing list