NSKeyValueMutableSet: Fix will and didChange notifications for set operations

This commit is contained in:
hmelder 2024-06-11 12:38:28 +02:00
parent d2a50254d0
commit 9f3fa5baa5

View file

@ -682,6 +682,7 @@
{
if (notifiesObservers && !changeInProgress)
{
NSLog(@"Observer Object: %@ addingObject: %@", object, anObject);
[object willChangeValueForKey: key
withSetMutation: NSKeyValueUnionSetMutation
usingObjects: [NSSet setWithObject: anObject]];
@ -718,14 +719,14 @@
{
[object willChangeValueForKey: key
withSetMutation: NSKeyValueUnionSetMutation
usingObjects: [NSSet setWithObject: anObject]];
usingObjects: anObject];
}
[set unionSet: anObject];
if (notifiesObservers && !changeInProgress)
{
[object didChangeValueForKey: key
withSetMutation: NSKeyValueUnionSetMutation
usingObjects: [NSSet setWithObject:anObject]];
usingObjects: anObject];
}
}
@ -735,14 +736,14 @@
{
[object willChangeValueForKey: key
withSetMutation: NSKeyValueMinusSetMutation
usingObjects: [NSSet setWithObject: anObject]];
usingObjects: anObject];
}
[set minusSet: anObject];
if (notifiesObservers && !changeInProgress)
{
[object didChangeValueForKey: key
withSetMutation: NSKeyValueMinusSetMutation
usingObjects: [NSSet setWithObject: anObject]];
usingObjects: anObject];
}
}
@ -752,14 +753,14 @@
{
[object willChangeValueForKey: key
withSetMutation: NSKeyValueIntersectSetMutation
usingObjects: [NSSet setWithObject: anObject]];
usingObjects: anObject];
}
[set intersectSet: anObject];
if (notifiesObservers && !changeInProgress)
{
[object didChangeValueForKey: key
withSetMutation: NSKeyValueIntersectSetMutation
usingObjects: [NSSet setWithObject: anObject]];
usingObjects: anObject];
}
}
@ -769,14 +770,14 @@
{
[object willChangeValueForKey: key
withSetMutation: NSKeyValueSetSetMutation
usingObjects: [NSSet setWithObject: anObject]];
usingObjects: anObject];
}
[set setSet: anObject];
if (notifiesObservers && !changeInProgress)
{
[object didChangeValueForKey: key
withSetMutation: NSKeyValueSetSetMutation
usingObjects: [NSSet setWithObject: anObject]];
usingObjects: anObject];
}
}
@end