Permalink
Browse files

Add an atexit() handler to delete the MythDownloadManager singleton.

(cherry picked from commit 26ab0d1)
  • Loading branch information...
1 parent 8d1c058 commit 613079eef4a3a1faf9cf513b44551173f06e07a6 @cpinkham cpinkham committed Jan 29, 2011
Showing with 14 additions and 0 deletions.
  1. +14 −0 mythtv/libs/libmythdb/mythdownloadmanager.cpp
@@ -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
@@ -128,6 +140,8 @@ MythDownloadManager *GetMythDownloadManager(void)
while (!downloadManager->isRunning())
usleep(10000);
+
+ atexit(ShutdownMythDownloadManager);
}
return downloadManager;

0 comments on commit 613079e

Please sign in to comment.