another tweak for using pointer identity rather than object equality

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39123 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2015-11-02 18:31:04 +00:00
parent 95a6eb6766
commit 77bfc5d864

View file

@ -65,6 +65,7 @@
#import "GSGuiPrivate.h" #import "GSGuiPrivate.h"
#include <math.h> #include <math.h>
static NSMapTableKeyCallBacks keyCallBacks;
static NSNotificationCenter *nc = nil; static NSNotificationCenter *nc = nil;
static const int current_version = 1; static const int current_version = 1;
@ -144,6 +145,11 @@ static NSImage *unexpandable = nil;
{ {
[self setVersion: current_version]; [self setVersion: current_version];
nc = [NSNotificationCenter defaultCenter]; nc = [NSNotificationCenter defaultCenter];
/* We need special map table callbacks, to check for identical
* objects rather than merely equal objects.
*/
keyCallBacks = NSObjectMapKeyCallBacks;
keyCallBacks.isEqual = NSOwnedPointerMapKeyCallBacks.isEqual;
#if 0 #if 0
/* Old Interface Builder style. */ /* Old Interface Builder style. */
collapsed = [NSImage imageNamed: @"common_outlineCollapsed"]; collapsed = [NSImage imageNamed: @"common_outlineCollapsed"];
@ -719,10 +725,10 @@ static NSImage *unexpandable = nil;
// create a new empty one // create a new empty one
_items = [[NSMutableArray alloc] init]; _items = [[NSMutableArray alloc] init];
_itemDict = NSCreateMapTable(NSObjectMapKeyCallBacks, _itemDict = NSCreateMapTable(keyCallBacks,
NSObjectMapValueCallBacks, NSObjectMapValueCallBacks,
64); 64);
_levelOfItems = NSCreateMapTable(NSObjectMapKeyCallBacks, _levelOfItems = NSCreateMapTable(keyCallBacks,
NSObjectMapValueCallBacks, NSObjectMapValueCallBacks,
64); 64);