X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fupdate_checker.cc;h=82337f92016905420316ad19daa1d1779804ffcf;hb=a2ceaa313a2b8ba28516c935f7f8b82d69957b77;hp=98e4078225d36f8619d4d34cd2e2fa3c3f24d639;hpb=9f4b7dd032e4d588720d46f858171c7f087f3e23;p=dcpomatic.git diff --git a/src/lib/update_checker.cc b/src/lib/update_checker.cc index 98e407822..82337f920 100644 --- a/src/lib/update_checker.cc +++ b/src/lib/update_checker.cc @@ -56,7 +56,6 @@ UpdateChecker::UpdateChecker () , _curl (0) , _state (NOT_RUN) , _emits (0) - , _thread (0) , _to_do (0) , _terminate (false) { @@ -74,9 +73,9 @@ UpdateChecker::UpdateChecker () void UpdateChecker::start () { - _thread = new boost::thread (boost::bind (&UpdateChecker::thread, this)); + _thread = boost::thread (boost::bind (&UpdateChecker::thread, this)); #ifdef DCPOMATIC_LINUX - pthread_setname_np (_thread->native_handle(), "update-checker"); + pthread_setname_np (_thread.native_handle(), "update-checker"); #endif } @@ -88,15 +87,13 @@ UpdateChecker::~UpdateChecker () } _condition.notify_all (); - if (_thread) { - /* Ideally this would be a DCPOMATIC_ASSERT(_thread->joinable()) but we - can't throw exceptions from a destructor. - */ - if (_thread->joinable ()) { - _thread->join (); + if (_thread.joinable()) { + try { + _thread.join (); + } catch (...) { + } } - delete _thread; curl_easy_cleanup (_curl); delete[] _buffer;