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

Huihong Luo huisinro at yahoo.com
Fri Jul 30 23:05:05 GMT 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);
strTrayWinID.clear();
}
}
 
 
-----Inline Attachment Follows-----


_______________________________________________
vbox-dev mailing list
vbox-dev at virtualbox.org
http://vbox.innotek.de/mailman/listinfo/vbox-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20100730/f2d7d996/attachment.html>


More information about the vbox-dev mailing list