Index: generic/threadSpCmd.c
===================================================================
RCS file: /cvsroot/tcl/thread/generic/threadSpCmd.c,v
retrieving revision 1.31
diff -u -r1.31 threadSpCmd.c
--- generic/threadSpCmd.c	18 Mar 2010 23:15:44 -0000	1.31
+++ generic/threadSpCmd.c	30 Mar 2010 22:34:23 -0000
@@ -369,6 +369,7 @@
     const char *mutexName;
     SpMutex *mutexPtr;
     Sp_ReadWriteMutex *rwPtr;
+    Sp_AnyMutex **lockPtr;
 
     static const char *cmdOpts[] = {
         "create", "destroy", "rlock", "wlock", "unlock", NULL
@@ -465,7 +466,8 @@
         return TCL_ERROR;
     }
 
-    rwPtr = (Sp_ReadWriteMutex*)&mutexPtr->lock;
+    lockPtr = &mutexPtr->lock;
+    rwPtr = (Sp_ReadWriteMutex*) lockPtr;
     
     switch ((enum options)opt) {
     case w_RLOCK:
@@ -1124,12 +1126,14 @@
 static int 
 SpMutexLock(SpMutex *mutexPtr)
 {
+    Sp_AnyMutex **lockPtr = &mutexPtr->lock;
+
     switch (mutexPtr->type) {
     case EMUTEXID:
-        return Sp_ExclusiveMutexLock((Sp_ExclusiveMutex*)&mutexPtr->lock);
+        return Sp_ExclusiveMutexLock((Sp_ExclusiveMutex*)lockPtr);
         break;
     case RMUTEXID: 
-        return Sp_RecursiveMutexLock((Sp_RecursiveMutex*)&mutexPtr->lock);
+        return Sp_RecursiveMutexLock((Sp_RecursiveMutex*)lockPtr);
         break;
     }
 
@@ -1156,12 +1160,14 @@
 static int
 SpMutexUnlock(SpMutex *mutexPtr)
 {
+    Sp_AnyMutex **lockPtr = &mutexPtr->lock;
+
     switch (mutexPtr->type) {
     case EMUTEXID:
-        return Sp_ExclusiveMutexUnlock((Sp_ExclusiveMutex*)&mutexPtr->lock);
+        return Sp_ExclusiveMutexUnlock((Sp_ExclusiveMutex*)lockPtr);
         break;
     case RMUTEXID:
-        return Sp_RecursiveMutexUnlock((Sp_RecursiveMutex*)&mutexPtr->lock);
+        return Sp_RecursiveMutexUnlock((Sp_RecursiveMutex*)lockPtr);
         break;
     }
 
@@ -1189,6 +1195,8 @@
 static int
 SpMutexFinalize(SpMutex *mutexPtr)
 {
+    Sp_AnyMutex **lockPtr = &mutexPtr->lock;
+
     if (AnyMutexIsLocked((Sp_AnyMutex*)mutexPtr->lock, (Tcl_ThreadId)0)) {
         return 0;
     }
@@ -1200,13 +1208,13 @@
 
     switch (mutexPtr->type) {
     case EMUTEXID:
-        Sp_ExclusiveMutexFinalize((Sp_ExclusiveMutex*)&mutexPtr->lock);
+        Sp_ExclusiveMutexFinalize((Sp_ExclusiveMutex*)lockPtr);
         break;
     case RMUTEXID:
-        Sp_RecursiveMutexFinalize((Sp_RecursiveMutex*)&mutexPtr->lock);
+        Sp_RecursiveMutexFinalize((Sp_RecursiveMutex*)lockPtr);
         break;
     case WMUTEXID:
-        Sp_ReadWriteMutexFinalize((Sp_ReadWriteMutex*)&mutexPtr->lock);
+        Sp_ReadWriteMutexFinalize((Sp_ReadWriteMutex*)lockPtr);
         break;
     default:
         break;
