Permalink
Browse files

Change ThreadPool shutdown to use deleteLater

This is to fix #9500, which has the frontend segfaulting on shutdown.  This
code will hopefully all be overhauled in the awaited webserver rewrite, but
in the mean time, let's have it behaving.

I also moved the order of removing from the deque and marking it for deletion,
as I was toying with different locking methods.
  • Loading branch information...
1 parent b34cf7d commit 255a074b19a9c72ee91a6028efe195d723854cf8 @Beirdo Beirdo committed Jan 23, 2011
Showing with 3 additions and 6 deletions.
  1. +3 −6 mythtv/libs/libmythupnp/threadpool.cpp
View
9 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();
+ }
}
/////////////////////////////////////////////////////////////////////////////

0 comments on commit 255a074

Please sign in to comment.