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:
parent
c570d5b24a
commit
7897aeb21f
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue