Commits

Bob Ippolito committed 79c1993

possibly get this right for panther and tiger?

Comments (0)

Files changed (2)

Modules/objc/class-builder.m

 _UseKVO(NSObject *self, NSString *key, int isSet)
 {           
 	int _checkedKVO = _KVOHackLevel();
+	NSNumber *n;
 	if (_checkedKVO == -1) {
 		return NO;
 	} else if (_checkedKVO == 2) {
 		return YES;
 	}
 	intptr_t setofs = (intptr_t)var->ivar_offset;
-	NSMutableSet **setPtr = (NSMutableSet **)(((char *)self) + setofs);
-	NSMutableSet *kvoSet = *setPtr;
-	if (!kvoSet) {
-		kvoSet = *setPtr = [[NSMutableSet alloc] initWithCapacity:0];
+	NSMutableDict **dictPtr = (NSMutableDict **)(((char *)self) + setofs);
+	NSMutableDict *kvoDict = *dictPtr;
+	if (!kvoDict) {
+		kvoDict = *setPtr = [[NSMutableDict alloc] initWithCapacity:0];
 	}   
 	if (isSet) {
-		if ([kvoSet containsObject:key]) {
-			return NO;
-		}   
-		[kvoSet addObject:key];
-	} else {
-		if (![kvoSet containsObject:key]) {
+		int setCount = [(NSNumber *)[kvoDict objectForKey:key] intValue] + 1;
+		n = [[NSNumber alloc] initWithInt:setCount];
+		[kvoDict setValue:n forKey:key];
+		[n release];
+		if (setCount != 1) {
 			return NO;
 		}
-		[kvoSet removeObject:key];
+	} else {
+		int setCount = [(NSNumber *)[kvoDict objectForKey:key] intValue] - 1;
+		n = [[NSNumber alloc] initWithInt:setCount];
+		[kvoDict setValue:n forKey:key];
+		[n release];
+		if (setCount != 0) {
+			return NO;
+		}
 	}
 	return YES;
 }

Modules/objc/objc-class.h

  * @field generation   The value of PyObjC_MappingCount at the last time
  *                     the method-list was updated.
  * @field useKVO    should the class implement automatic KVO notifications?
- * @field keysetoffset Offset of the NSMutableSet used to keep track of
- *                     notifications on Panther
  *
  * @discussion
  *      This struct is the type-object for on Objective-C class. It stores
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.