bugGNUstep - Bugs: bug #6226, Segmentation fault when...

 
 

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

bug #6226: Segmentation fault when application finishes

Submitted by:  Benhur Stein <benhur>
Submitted on:  Tue 28 Oct 2003 11:45:34 PM UTC  
 
Category: Gui/AppKitSeverity: 1,5
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Wed 29 Oct 2003 07:02:19 AM UTC, comment #1:

I applied that fix ... thanks.

Richard Frith-Macdonald <CaS>
Project Member
Tue 28 Oct 2003 11:45:34 PM UTC, original submission:

Some applications generate a segmentation fault when finishing.
It goes like this:

NSApplication -dealloc releases the GSDisplayServer associated
to _app_icon_window. It gets deallocated.

NSResponder (NSApplication's super) -dealloc releases _menu

menu releases it's window.

NSWindow's dealloc calls GSServerForWindow(self) and obtains a pointer to the deallocated server.
NSWindow sends removeDragTypes:fromWindow to this deallocated object... boom!

The problem is that there is a NSMapTable to map windows to
DisplayServers, and this map doesn't get updated when a displayserver is deallocated.

Adding the following method to GSDisplayServer and calling it from -dealloc solves the problem.

Benhur

- (void) _removeFromWindowMap
{
NSMapEnumerator enumerator;
void *key;
void *val;

enumerator = NSEnumerateMapTable(windowmaps);
while (NSNextMapEnumeratorPair(&enumerator, &key, &val))
{
if (val == self)
{
NSMapRemove(windowmaps, key);
}
}
NSEndMapTableEnumeration(&enumerator);
}

Benhur Stein <benhur>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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 29 Oct 2003 07:02:18 AM UTCCaSStatusNone=>(Error - Not Found)
  Open/ClosedOpen=>(Error - Not Found)

Back to the top


Powered by Savane 3.1-cleanup1