Author: rfm
Date: Thu Nov 20 10:40:23 2014
New Revision: 38187
URL: http://svn.gna.org/viewcvs/gnustep?rev=38187&view=rev
Log:
minor optimisation ... avoid unnecessary retain/release
Modified:
libs/base/trunk/Source/NSRunLoop.m
Modified: libs/base/trunk/Source/NSRunLoop.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSRunLoop.m?rev=38187&r1=38186&r2=38187&view=diff
==============================================================================
--- libs/base/trunk/Source/NSRunLoop.m (original)
+++ libs/base/trunk/Source/NSRunLoop.m Thu Nov 20 10:40:23 2014
@@ -443,27 +443,29 @@
NSAutoreleasePool *arp = [NSAutoreleasePool new];
GSRunLoopPerformer *array[count];
NSMapEnumerator enumerator;
- GSRunLoopCtxt *context;
+ GSRunLoopCtxt *original;
void *mode;
unsigned i;
found = YES;
- /*
- * Copy the array - because we have to cancel the requests
- * before firing.
+
+ /* We have to remove the performers before firing, so we copy
+ * the pointers withoutm releasing the objects, and then set
+ * the array to be empty.
*/
for (i = 0; i < count; i++)
{
- array[i] = RETAIN(GSIArrayItemAtIndex(performers, i).obj);
- }
-
- /*
- * Remove the requests that we are about to fire from all modes.
+ array[i] = GSIArrayItemAtIndex(performers, i).obj;
+ }
+ performers->count = 0;
+
+ /* Remove the requests that we are about to fire from all modes.
*/
+ original = context;
enumerator = NSEnumerateMapTable(_contextMap);
while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&context))
{
- if (context != nil)
+ if (context != nil && context != original)
{
GSIArray performers = context->performers;
unsigned tmpCount = GSIArrayCount(performers);
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs