From ab8692bd96bb6a1a74dd2201616d5cc6b78fb1d1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 5 Feb 2022 19:16:06 +0900 Subject: [PATCH] [qwaq] Allow return values through forwarded messages This was easy to achieve in v6p progs because all return values passed through .return and thus could not be lost. However, Ruamoko progs use a return pointer which can wind up pointed into the void (the return buffer) and thus cause the return value to be lost. Using @return on obj_msg_sendv bounces the return pointer through to the called function. In addition, nil is returned when the forwarding target is nil. --- ruamoko/qwaq/ui/proxyview.r | 4 ++-- ruamoko/qwaq/ui/view.r | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ruamoko/qwaq/ui/proxyview.r b/ruamoko/qwaq/ui/proxyview.r index 714b3fd9d..c39358092 100644 --- a/ruamoko/qwaq/ui/proxyview.r +++ b/ruamoko/qwaq/ui/proxyview.r @@ -10,9 +10,9 @@ - (void) forward: (SEL) sel : (@va_list) args { if (!view) { - return; + @return nil; } - obj_msg_sendv (view, sel, args); + @return obj_msg_sendv (view, sel, args); } -initWithView:(View *) view diff --git a/ruamoko/qwaq/ui/view.r b/ruamoko/qwaq/ui/view.r index c7fbe58c8..1b7fb4c06 100644 --- a/ruamoko/qwaq/ui/view.r +++ b/ruamoko/qwaq/ui/view.r @@ -264,12 +264,12 @@ updateScreenCursor (View *view) - (void) forward: (SEL) sel : (@va_list) args { if (!textContext) { - return; + @return nil; } if (!__obj_responds_to (textContext, sel)) { [self error: "no implementation for %s", sel_get_name (sel)]; } - obj_msg_sendv (textContext, sel, args); + @return obj_msg_sendv (textContext, sel, args); } - (void) refresh