From 658003a847b832ffe5ef57515e4c27c1604a7942 Mon Sep 17 00:00:00 2001 From: rfm Date: Tue, 17 Aug 2010 07:35:20 +0000 Subject: [PATCH] improve comments git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31173 72102866-910b-0410-8b05-ffd578937521 --- Source/NSNotificationQueue.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/NSNotificationQueue.m b/Source/NSNotificationQueue.m index e1dc91538..04a02271a 100644 --- a/Source/NSNotificationQueue.m +++ b/Source/NSNotificationQueue.m @@ -613,12 +613,21 @@ notify(NSNotificationCenter *center, NSNotificationQueueList *list, */ if (len > 0) { + /* First, we make a note of each notification while removing the + * corresponding list item from the queue ... so that when we get + * round to posting the notifications we will not get problems + * with another notif() trying to use the same items. + */ for (pos = 0; pos < len; pos++) { item = ptr[pos]; ptr[pos] = RETAIN(item->notification); remove_from_queue(list, item, zone); } + + /* Now that we no longer need to worry about r-entrancy, + * we step through our notifications, posting each one in turn. + */ for (pos = 0; pos < len; pos++) { NSNotification *n = (NSNotification*)ptr[pos]; @@ -626,6 +635,7 @@ notify(NSNotificationCenter *center, NSNotificationQueueList *list, [center postNotification: n]; RELEASE(n); } + if (allocated) { NSZoneFree(NSDefaultMallocZone(), ptr);