Skip to content

Commit

Permalink
Add an atexit() handler to delete the MythDownloadManager singleton.
Browse files Browse the repository at this point in the history
(cherry picked from commit 26ab0d1)
  • Loading branch information
cpinkham committed Jan 29, 2011
1 parent 8d1c058 commit 613079e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mythtv/libs/libmythdb/mythdownloadmanager.cpp
Expand Up @@ -110,6 +110,18 @@ class RemoteFileDownloadThread : public QRunnable
MythDownloadInfo *m_dlInfo;
};

/** \fn ShutdownMythDownloadManager(void)
* \brief Deletes the running MythDownloadManager at program exit.
*/
void ShutdownMythDownloadManager(void)
{
if (downloadManager)
{
delete downloadManager;
downloadManager = NULL;
}
}

/** \fn GetMythDownloadManger(void)
* \brief Gets the pointer to the MythDownloadManager singleton.
* \return Pointer to the MythDownloadManager instance
Expand All @@ -128,6 +140,8 @@ MythDownloadManager *GetMythDownloadManager(void)

while (!downloadManager->isRunning())
usleep(10000);

atexit(ShutdownMythDownloadManager);
}

return downloadManager;
Expand Down

0 comments on commit 613079e

Please sign in to comment.