Archive: Incorrect progress indicator when calling return


Incorrect progress indicator when calling return
  Hi,

There is a bug when using Return to prematurely exit from a section. This bug causes the progress bar not to "finish" the install, meaning it will remain with a value smaller than it's maximum.

It seems that it misses the value given by the size of the files added to the section after the return was called.

I test it both on v2.0b1 and v2.0b2 with the same result.

I attached an example script that shows the problem. j2re-1_4_1_02-windows-i586.exe in this case is a big file (~8Mb) while the files from the section "My files" are small. I think the bigger this file is, the "distance" to the end of the progress becomes bigger.

If you run the installer from this script you can see the problem, but if you comment line 32 and uncomment line 33, the problem goes. To put it short: use goto instead of return.

So if you encounter this problem and a fix is not made, you should use this workaround.

Cheers
Chris


Return in a section is the same as Abort just without any text. You are not supposed to use that and there is absolutely no reason to. To get out of a section jump to the end of it using Goto.


Can you give me an example of what's the use for Return ?
From your post I understand that Return must not be used in any circumstances, which is kinda of odd, since it's in the documentation and from that I understood it has a similar purpose to that of the return keyword from C/C++.

Chris


Return is to be used as functions. In functions it acts just like the C/C++ return keyword. It can also be used in called labels such as in the UpgradeDLL macro.

Example:


Test

MessageBox MB_YESNO"Would you like to do some testings?" IDYES +2
Return
# do stuff...
>FunctionEnd
>

Then the docs must be updated cause it says "Returns from a function or section." so I thought it has the same effect on sections as it has on functions.

anyway thx for the clarifications.


I am sorry, my mistake. It's like abort with no text only to that section. So in a way it does return from the section but the progress bar won't advance because it can't know if it's the return that is automatically tagged at the end of the section or your return.


Ok thx, I understand in a way why it's difficult to advance the progress because it doesn't know in advance the size of the files that are added after the return statement.
Maybe some function similar to AddSize that will advance the progress will do it but i think it's a little to much when goto can be used.

Oh well, goto is not that bad :)

Cheers,
Chris