From d7dc9025cd32016ecbb9cb71799de491637604da Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 13 Jan 2006 15:24:46 +0000 Subject: [PATCH] fixed bug #1403608 - Callback function called when host function already returned explain in documentation that the callback destination variable must be cleared git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4474 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/System/System.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Contrib/System/System.html b/Contrib/System/System.html index 65831728..1238a51d 100644 --- a/Contrib/System/System.html +++ b/Contrib/System/System.html @@ -371,7 +371,7 @@ StrCmp $R0 "callback1" 0 +2 DetailPrint "UseCallback passed ($0, $1) to the callback" -

After you've processed the callback call, you should use Call, passing it the value returned by Get - the callback. This tells System to return from the callback. If you've specified a source for the return "parameter" when the callback was created, you should fill that source with the appropriate return value. Callbacks are not automatically freed, don't forget to free it after you've finished using it.

+

After you've processed the callback call, you should use Call, passing it the value returned by Get - the callback. This tells System to return from the callback. Destination of the return "parameter" must be cleared prior to calling a function, to avoid false detection of a callback call. If you've specified a source for the return "parameter" when the callback was created, you should fill that source with the appropriate return value. Callbacks are not automatically freed, don't forget to free it after you've finished using it.

SetPluginUnload alwaysoff
 System::Get "(i .r0, i .r1) isR0"
@@ -381,6 +381,7 @@ loop:
 	StrCmp $R0 "callback1" 0 done
 	DetailPrint "UseCallback passed ($0, $1) to the callback"
 	Push 1 # return value of the callback
+	StrCpy $R0 "" # clear $R0 in case there are no more callback calls
 	System::Call $0 # tell system to return from the callback
 	Goto loop
 done: