Skip to content

Commit

Permalink
Fix memory leak.
Browse files Browse the repository at this point in the history
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 3cee24d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mythtv/libs/libmythui/mythuinotificationcenter.cpp
Expand Up @@ -519,6 +519,7 @@ MythUINotificationCenter::~MythUINotificationCenter()

QMutexLocker lock(&m_lock);

DeleteAllRegistrations();
DeleteAllScreens();

// Delete all outstanding queued notifications
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/mythuinotificationcenter.h
Expand Up @@ -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);
Expand Down

0 comments on commit 3cee24d

Please sign in to comment.