safety fix in case code incorrectly tries to use the reuslt of forwarding a method to the undo manager.

This commit is contained in:
rfm 2024-10-29 14:59:43 +00:00
parent 4f0a8d60c2
commit 156be3ad53
2 changed files with 13 additions and 0 deletions

View file

@ -1,4 +1,10 @@
2024-10-29 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUndoManager.m: set zero/nil return value when forwarding
invocation ... in case calling code tries to use the result.
2024-10-28 Hugo Melder <hugo@algoriddim.com>
* Source/NSString.m:
-commonPrefixWithString:options: returns nil when string supplied as
first argument is nil. On macOS, the empty string is returned instead.

View file

@ -429,6 +429,11 @@
*/
- (void) forwardInvocation: (NSInvocation*)anInvocation
{
NSUInteger size = [[anInvocation methodSignature] methodReturnLength];
unsigned char v[size];
memset(v, '\0', size);
if (_disableCount == 0)
{
if (_nextTarget == nil)
@ -466,6 +471,8 @@
_runLoopGroupingPending = YES;
}
}
[anInvocation setReturnValue: (void*)v];
}
/**