diff --git a/mythtv/libs/libmythupnp/threadpool.cpp b/mythtv/libs/libmythupnp/threadpool.cpp index 9059dc111c5..8badd1684ac 100644 --- a/mythtv/libs/libmythupnp/threadpool.cpp +++ b/mythtv/libs/libmythupnp/threadpool.cpp @@ -326,14 +326,11 @@ ThreadPool::~ThreadPool( ) while (it != m_lstThreads.end() ) { WorkerThread *pThread = *it; - - if (pThread != NULL) - delete pThread; - it = m_lstThreads.erase( it ); - } - + if (pThread != NULL) + pThread->deleteLater(); + } } /////////////////////////////////////////////////////////////////////////////