discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSHashTable and MapTable callbacks bugs


From: Richard Frith-Macdonald
Subject: Re: NSHashTable and MapTable callbacks bugs
Date: Wed, 23 Jan 2002 13:19:49 +0000

On Wednesday, January 23, 2002, at 11:22 AM, Stephen Brandon wrote:

Hi,

I'm pretty sure this is a bug in GNUstep - it seems at least to be a
difference in implementation from that of MacOSX because code that works on MacOSX crashes GNUstep. And the documentation seems to describe the MacOSX
behaviour rather than GNUstep.

Anyway, here's the problem:

When you create a set of NSMapTable callbacks, you are supposed to be able to set NULL for any one of them, and then that function is set to the default
within Foundation (eg for hashing, equality, retaining, releasing,
description).

What actually happens in gnustep-base is that the NULL pointer is called as a
function, and segfaults.

What I'd really like to do is rewrite the hashtable and maptable code to use the same GSIMap stuff that NSSet and NSDictionary are using. This would make
things more efficient, let us reduxe the size of the codebase, and let us
correct a few minor bugs like this one.
Unfortunately I just haven't got round to it yet.

I believe that a 'correct' implementation should take a copy of the supplied
callbacks and use that copy replacing nul pointers with default ones.
That way the hash/map table would be immune to changes made in the original
callbacks structure after the table is created.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]