Fixed memory leak: remove the old tray icon menu before set a new one.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4006 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2010-12-22 11:39:03 +00:00
parent c570d5b24a
commit 7897aeb21f
1 changed files with 3 additions and 0 deletions

View File

@ -1019,6 +1019,9 @@ bool QtWindow::setParams(const NamedList& params)
// Check context menu
NamedString* menu = nl->getParam("menu");
if (menu) {
QMenu* oldMenu = trayIcon->contextMenu();
if (oldMenu)
delete oldMenu;
NamedList* nlMenu = static_cast<NamedList*>(menu->getObject("NamedList"));
trayIcon->setContextMenu(nlMenu ? QtClient::buildMenu(*nlMenu,*menu,this,
SLOT(action()),SLOT(toggled(bool)),this) : 0);