[vlc-commits] fix win32 threadvar linked list

Sébastien Escudier git at videolan.org
Tue Nov 8 10:08:58 CET 2011


vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Mon Nov  7 15:32:16 2011 +0100| [1476c5eed1366cec0453b2bb2a3e7b8c60b1a0d7] | committer: Sébastien Escudier

fix win32 threadvar linked list

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1476c5eed1366cec0453b2bb2a3e7b8c60b1a0d7
---

 src/win32/thread.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 22082be..e8299f3 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -495,6 +495,9 @@ int vlc_threadvar_create (vlc_threadvar_t *p_tls, void (*destr) (void *))
 
     vlc_mutex_lock (&super_mutex);
     var->prev = vlc_threadvar_last;
+    if (var->prev)
+        var->prev->next = var;
+
     vlc_threadvar_last = var;
     vlc_mutex_unlock (&super_mutex);
     return 0;
@@ -507,10 +510,12 @@ void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
     vlc_mutex_lock (&super_mutex);
     if (var->prev != NULL)
         var->prev->next = var->next;
-    else
-        vlc_threadvar_last = var->next;
+
     if (var->next != NULL)
         var->next->prev = var->prev;
+    else
+        vlc_threadvar_last = var->prev;
+
     vlc_mutex_unlock (&super_mutex);
 
     TlsFree (var->id);



More information about the vlc-commits mailing list