bugGNUstep - Bugs: bug #25915, Segfault in -[NSNotificationQueue...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25915: Segfault in -[NSNotificationQueue dealloc]

Submitted by:  Larry Campbell <lcampbel>
Submitted on:  Wed 18 Mar 2009 02:56:06 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Wed 18 Mar 2009 03:48:57 PM UTC, comment #1:

Thanks, I simplified/fixed the code in svn.

Richard Frith-Macdonald <CaS>
Project Member
Wed 18 Mar 2009 02:56:06 PM UTC, original submission:

-[NSNotificationQueue dealloc] traverses a linked list of NSNotificationQueueRegistration objects, deleting each object from the queue, but makes the classic mistake of dereferencing the link to the next object after the object has been freed.

Here's the fix:

--- NSNotificationQueue.m.orig 2008-06-09 00:05:01.000000000 -0400
+++ NSNotificationQueue.m 2009-03-18 10:51:55.000000000 -0400
@@ -353,6 +353,7 @@
- (void) dealloc
{
NSNotificationQueueRegistration *item;
+ NSNotificationQueueRegistration *prev;

/*
* remove from class instances list
@@ -362,14 +363,16 @@
/*
* release self from queues
*/
- for (item = _asapQueue->head; item; item=item->prev)
+ for (item = _asapQueue->head; item; item=prev)
{
+ prev = item->prev;
remove_from_queue(_asapQueue, item, _zone);
}
NSZoneFree(_zone, _asapQueue);

- for (item = _idleQueue->head; item; item=item->prev)
+ for (item = _idleQueue->head; item; item=prev)
{
+ prev = item->prev;
remove_from_queue(_idleQueue, item, _zone);
}
NSZoneFree(_zone, _idleQueue);

Larry Campbell <lcampbel>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by lcampbel (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 18 Mar 2009 03:48:57 PM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1