Permalink
Browse files

Fix memory leak.

Screens for registered clients weren't deleted in MythUINotificationCenter destructor. Leak wouldn't only have existed when frontend exited
  • Loading branch information...
jyavenard committed Jul 8, 2013
1 parent cf093aa commit 3cee24d181a2ab0fafca512838ee9cb89c000011
@@ -519,6 +519,7 @@ MythUINotificationCenter::~MythUINotificationCenter()
QMutexLocker lock(&m_lock);
DeleteAllRegistrations();
DeleteAllScreens();
// Delete all outstanding queued notifications
@@ -829,6 +830,18 @@ MythNotificationScreenStack *MythUINotificationCenter::GetScreenStack(void)
return m_screenStack;
}
void MythUINotificationCenter::DeleteAllRegistrations(void)
{
QMap<int, MythUINotificationScreen*>::iterator it = m_registrations.begin();
for (; it != m_registrations.end();)
{
m_deletedScreens.append(*it);
it = m_registrations.erase(it);
}
m_registrations.clear();
}
void MythUINotificationCenter::DeleteAllScreens(void)
{
// delete all screens waiting to be deleted
@@ -118,6 +118,7 @@ private slots:
int id = -1);
MythNotificationScreenStack *GetScreenStack(void);
void ScreenStackDeleted(void);
void DeleteAllRegistrations(void);
void DeleteAllScreens(void);
int InsertScreen(MythUINotificationScreen *screen);
int RemoveScreen(MythUINotificationScreen *screen);

0 comments on commit 3cee24d

Please sign in to comment.