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 313b9b5610
commit 3e55c3b296
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> 2024-10-28 Hugo Melder <hugo@algoriddim.com>
* Source/NSString.m: * Source/NSString.m:
-commonPrefixWithString:options: returns nil when string supplied as -commonPrefixWithString:options: returns nil when string supplied as
first argument is nil. On macOS, the empty string is returned instead. first argument is nil. On macOS, the empty string is returned instead.

View file

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