You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2007/10/01 15:58:30 UTC

svn commit: r580961 - /incubator/stdcxx/branches/4.2.0/src/setlocale.cpp

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 <vi...@roguewave.com>

	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;
 }