stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r597266 - /incubator/stdcxx/trunk/src/messages.cpp
Date Wed, 21 Nov 2007 23:45:41 GMT
Author: sebor
Date: Wed Nov 21 15:45:28 2007
New Revision: 597266

URL: http://svn.apache.org/viewvc?rev=597266&view=rev
Log:
2007-11-20 Travis Vitek <vitek@roguewave.com>

	Merged rev 597265 with a fix for STDCXX-607 from branches/4.2.x.
	* src/messages.cpp (__rw_cat_close): Put lock guard into local scope
	to avoid recursive acquire on error.

Modified:
    incubator/stdcxx/trunk/src/messages.cpp

Modified: incubator/stdcxx/trunk/src/messages.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/src/messages.cpp?rev=597266&r1=597265&r2=597266&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/messages.cpp (original)
+++ incubator/stdcxx/trunk/src/messages.cpp Wed Nov 21 15:45:28 2007
@@ -275,27 +275,37 @@
 // Close a catalog and release its handle.
 void __rw_cat_close (int cat)
 {
-    _RWSTD_MT_CLASS_GUARD (__rw_open_cat_data);
+    bool cat_closed = false;
+
+    {
+        // guard is local to this scope to avoid reacquiring the mutex
+        // if have to generate an exception message string below.
+        _RWSTD_MT_CLASS_GUARD (__rw_open_cat_data);
     
-    __rw_open_cat_data* const pcat_data =
-        cat < 0 ? 0 : __rw_manage_cat_data (cat, 0);
+        __rw_open_cat_data* const pcat_data =
+            cat < 0 ? 0 : __rw_manage_cat_data (cat, 0);
 
-    // 22.2.7.1.2, p5: `catalog' must be valid
-    if (pcat_data && pcat_data->catd != _RWSTD_BAD_CATD) {
+        // 22.2.7.1.2, p5: `catalog' must be valid
+        if (pcat_data && pcat_data->catd != _RWSTD_BAD_CATD) {
 
-	catclose (pcat_data->catd);
+            catclose (pcat_data->catd);
 
-	_STD::locale* const ploc =
-            _RWSTD_REINTERPRET_CAST (_STD::locale*, &pcat_data->loc);
+            _STD::locale* const ploc =
+                _RWSTD_REINTERPRET_CAST (_STD::locale*, &pcat_data->loc);
 
-	ploc->~locale ();
+            ploc->~locale ();
 
-	__rw_manage_cat_data (cat, pcat_data);
-    }
-    else {
-        _RWSTD_REQUIRES (0, (_RWSTD_ERROR_INVALID_ARGUMENT,
-                             _RWSTD_FUNC ("__rw_cat_close (int cat)")));
+            __rw_manage_cat_data (cat, pcat_data);
+
+            cat_closed = true;
+        }
+        else {
+            cat_closed = false;
+        }
     }
+
+    _RWSTD_REQUIRES (cat_closed, (_RWSTD_ERROR_INVALID_ARGUMENT,
+                                  _RWSTD_FUNC ("__rw_cat_close (int cat)")));
 }
 
 



Mime
View raw message