summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Pinkham <cpinkham@mythtv.org>2011-01-29 05:52:30 (GMT)
committer Chris Pinkham <cpinkham@mythtv.org>2011-01-29 05:53:45 (GMT)
commit613079eef4a3a1faf9cf513b44551173f06e07a6 (patch)
treeb857fc1b74f1fef12720fb679bfcb8f4f9f3503a
parent8d1c058411db38440740bbc5b0957edb09171c04 (diff)
Add an atexit() handler to delete the MythDownloadManager singleton.
(cherry picked from commit 26ab0d1bdddb28d826328576f8c048f0f283f883)
-rw-r--r--mythtv/libs/libmythdb/mythdownloadmanager.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/mythtv/libs/libmythdb/mythdownloadmanager.cpp b/mythtv/libs/libmythdb/mythdownloadmanager.cpp
index 22a8274..89349a2 100644
--- a/mythtv/libs/libmythdb/mythdownloadmanager.cpp
+++ b/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;