Author: rfm
Date: Sun Aug 30 08:40:40 2015
New Revision: 38951
URL: http://svn.gna.org/viewcvs/gnustep?rev=38951&view=rev
Log:
fix potential deadlock
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/NSOperation.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=38951&r1=38950&r2=38951&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Sun Aug 30 08:40:40 2015
@@ -1,3 +1,7 @@
+2015-08-30 Richard Frith-Macdonald <[email protected]>
+
+ * Source/NSOperation.m: Fix potential deadlock with adding observers.
+
2015-08-29 Richard Frith-Macdonald <[email protected]>
* Source/Additions/GSMime.m: Improve descriptions for debug.
Modified: libs/base/trunk/Source/NSOperation.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSOperation.m?rev=38951&r1=38950&r2=38951&view=diff
==============================================================================
--- libs/base/trunk/Source/NSOperation.m (original)
+++ libs/base/trunk/Source/NSOperation.m Sun Aug 30 08:40:40 2015
@@ -886,9 +886,12 @@
internal->executing--;
[object removeObserver: self
forKeyPath: @"isFinished"];
+ [internal->lock unlock];
[self willChangeValueForKey: @"operations"];
[self willChangeValueForKey: @"operationCount"];
+ [internal->lock lock];
[internal->operations removeObjectIdenticalTo: object];
+ [internal->lock unlock];
[self didChangeValueForKey: @"operationCount"];
[self didChangeValueForKey: @"operations"];
}
@@ -897,8 +900,8 @@
[object removeObserver: self
forKeyPath: @"isReady"];
[internal->waiting addObject: object];
- }
- [internal->lock unlock];
+ [internal->lock unlock];
+ }
[self _execute];
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs