Bugfix for performing action at end of run loop - do it only once, not once per loop iteration.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@7447 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-09-08 09:14:29 +00:00
parent 83a454c172
commit 6fdd577b58
2 changed files with 38 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2000-09-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSRunLoop.m: ([-_checkPerformers:]) When a loop executes the
method to deal with a ([-performSelector:target:argument:order:modes]),
we cancel the request rather than leaving it to be actioned again next
time round the loop.
2000-09-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSGeometry.m: Add code to parse MacOS-X format strings.

View file

@ -275,7 +275,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
timer = nil;
[target performSelector: selector withObject: argument];
[[[NSRunLoop currentInstance] _timedPerformers]
removeObjectIdenticalTo: self];
removeObjectIdenticalTo: self];
}
- (void) gcFinalize
@ -455,17 +455,45 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
if (performers != 0 && (count = GSIArrayCount(performers)) > 0)
{
GSRunLoopPerformer *array[count];
NSMapEnumerator enumerator;
GSIArray tmp;
void *mode;
unsigned i;
/*
* Copy the array - so we don't get messed up by any changes caused
* by 'fire'ing the performers.
* Copy the array - because we have to cancel the requests before firing.
*/
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.
*/
enumerator = NSEnumerateMapTable(_mode_2_performers);
while (NSNextMapEnumeratorPair(&enumerator, &mode, (void**)&tmp))
{
unsigned tmpCount = GSIArrayCount(tmp);
while (tmpCount--)
{
GSRunLoopPerformer *p;
p = GSIArrayItemAtIndex(tmp, tmpCount).obj;
for (i = 0; i < count; i++)
{
if (p == array[i])
{
GSIArrayRemoveItemAtIndex(tmp, tmpCount);
}
}
}
}
/*
* Finally, fire the requests.
*/
for (i = 0; i < count; i++)
{
[array[i] fire];