platform: fixed initial value of m_thread in CThread
[deb_libcec.git] / src / lib / platform / threads / threads.h
index e29578c728a1b5b0abf5288b5898615433fb6498..36477708d4750e6c2e035ca739d067f06cdff26a 100644 (file)
@@ -41,16 +41,15 @@ namespace PLATFORM
     CThread(void) :
         m_bStop(false),
         m_bRunning(false),
-        m_bStopped(false) {}
+        m_bStopped(false),
+        m_thread(INVALID_THREAD_VALUE) {}
 
     virtual ~CThread(void)
     {
       StopThread(0);
-      void *retVal;
-      ThreadsWait(m_thread, &retVal);
-      #if defined(__WINDOWS__)
-      (void *)retVal; //"unreferenced local variable" warning
-      #endif
+      void *retVal = NULL;
+      if (m_thread != INVALID_THREAD_VALUE)
+        ThreadsWait(m_thread, &retVal);
     }
 
     static void *ThreadHandler(CThread *thread)