Author: rfm
Date: Wed Feb 10 11:22:43 2016
New Revision: 39351
URL: http://svn.gna.org/viewcvs/gnustep?rev=39351&view=rev
Log:
Fix recursion when looking up the current thread
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/NSThread.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39351&r1=39350&r2=39351&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Wed Feb 10 11:22:43 2016
@@ -1,9 +1,17 @@
+2016-02-10 Richard Frith-Macdonald <[email protected]>
+
+ * Source/NSThread.m: In GSCurrentThread() the check for exiting
+ thread needs to NOT be wrapped in an exception handler, since the
+ exception handling code can attempt to get the current thread,
+ causing recursion.
+
2016-02-09 Richard Frith-Macdonald <[email protected]>
* Source/NSUserDefaults.m:
Remove dependency on NSUserDefaults in order to parse property list
in program arguments ... get boolean defaults settings from the
argument domain
+
2016-02-09 Larry Campbell <[email protected]>
* Source/NSUserDefaults.m: Fix for bug #46956
Modified: libs/base/trunk/Source/NSThread.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSThread.m?rev=39351&r1=39350&r2=39351&view=diff
==============================================================================
--- libs/base/trunk/Source/NSThread.m (original)
+++ libs/base/trunk/Source/NSThread.m Wed Feb 10 11:22:43 2016
@@ -610,21 +610,17 @@
GSCurrentThread(void)
{
NSThread *thr = pthread_getspecific(thread_object_key);
+
if (nil == thr)
{
NSValue *selfThread = NSValueCreateFromPthread(pthread_self());
+
+ /* NB this locked section cannot be protected by an exception handler
+ * because the exception handler stores information in the current
+ * thread variables ... which causes recursion.
+ */
[_exitingThreadsLock lock];
- NS_DURING
- {
- thr = NSMapGet(_exitingThreads, (const void*)selfThread);
- }
- NS_HANDLER
- {
- [_exitingThreadsLock unlock];
- DESTROY(selfThread);
- [localException raise];
- }
- NS_ENDHANDLER
+ thr = NSMapGet(_exitingThreads, (const void*)selfThread);
[_exitingThreadsLock unlock];
DESTROY(selfThread);
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs