Author: faridz
Date: Mon Oct  1 06:58:30 2007
New Revision: 580961

URL: http://svn.apache.org/viewvc?rev=580961&view=rev
Log:
2007-10-01 Travis Vitek <[EMAIL PROTECTED]>

        STDCXX-452
        * setlocale.cpp (~__rw_setlocale): Restore the previous
        locale in a threadsafe manner. Simplified.

Modified:
    incubator/stdcxx/branches/4.2.0/src/setlocale.cpp

Modified: incubator/stdcxx/branches/4.2.0/src/setlocale.cpp
URL: 
http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.0/src/setlocale.cpp?rev=580961&r1=580960&r2=580961&view=diff
==============================================================================
--- incubator/stdcxx/branches/4.2.0/src/setlocale.cpp (original)
+++ incubator/stdcxx/branches/4.2.0/src/setlocale.cpp Mon Oct  1 06:58:30 2007
@@ -135,18 +135,18 @@
 // was in effect when the object was constructed
 __rw_setlocale::~__rw_setlocale ()
 {
-    // release the lock
-    if (_C_guard)
-        __rw_setlocale_mutex._C_release ();
-
-    if (_C_name) {
+    // if guard is set, constructor changed the locale
+    if (_C_guard) {
 
-        // and restore the locale
+        // restore the locale
         ::setlocale (_C_cat, _C_name);
 
-        if (_C_name != _C_namebuf)
-            delete [] _C_name;
+        // release the lock
+        __rw_setlocale_mutex._C_release ();
     }
+
+    if (_C_name != _C_namebuf)
+        delete [] _C_name;
 }
 
 


Reply via email to