- NSIS Discussion
- Banner hangs when called from custom page.
Archive: Banner hangs when called from custom page.
lybra
8th May 2007 14:40 UTC
Banner hangs when called from custom page.
I have created a custom page to install .NET Framework 2.0. This page uses a banner to show while the .NET installer is running. However, if I press Cancel in the .NET installer, the NSIS installer hangs.
If I use the same code in an installation section of the main page, it does work OK.
Simplified code sample of the main page:
; Pages
!insertmacro MUI_PAGE_COMPONENTS
Page custom PageDotNet2 InstallDotNet2
!insertmacro MUI_PAGE_INSTFILES
; Sections
Section x
; install .NET Framework 2.0
Banner::show /NOUNLOAD /set 76 $(InstallingNet2) $(PleaseWait)
ExecWait '"$REDISTRIBUTABLES_FOLDER\dotnetfx.exe"'
Banner::destroy
SectionEnd
The InstallDotNet2 function in my custom page contains the exact same code as Section x on the main page. If I comment out the Banner statements in the InstallDotNet2 function, everything works fine.
goldy1064
8th May 2007 16:38 UTC
You could try ensuring that the current working directory is set to $PLUGINSDIR before doing calls to the banner plugin.
Section x
; install .NET Framework 2.0
SetOutPath "$PLUGINSDIR"
Banner::show /NOUNLOAD /set 76 $(InstallingNet2) $(PleaseWait)
ExecWait '"$REDISTRIBUTABLES_FOLDER\dotnetfx.exe"'
SetOutPath "$PLUGINSDIR"
Banner::destroy
SectionEnd
Afrow UK
8th May 2007 16:39 UTC
Use InitPluginsDir for that.
Stu
lybra
9th May 2007 07:23 UTC
I've tried adding the InitPluginsDir statement at the top of the function and right after the ExecWait call, but without success.
I found some more strange behaviour: if I add a MessageBox call after the ExecWait call, but before the Banner::destroy, the message box gets shown and when I click that away, the installer continues. If I place the MessageBox call after the Banner::destroy, the installer hangs. If I remove the MessageBox call, it also hangs.
The code below works (but gives me an unwanted message box); if I (re)move the MessageBox call, it hangs. Again, only in the function on the custom page. The banner is working fine in my main installer section.
Function InstallDotNet2
; install .NET Framework 2.0
InitPluginsDir
Banner::show /NOUNLOAD /set 76 $(InstallingNet2) $(PleaseWait)
ExecWait '"$REDISTRIBUTABLES_FOLDER\dotnetfx.exe"'
InitPluginsDir
MessageBox MB_OK "x"
Banner::destroy
FunctionEnd
Afrow UK
9th May 2007 11:29 UTC
Are you using the latest version of NSIS. This could be a new bug. I've used the banner plugin between pages in the past with no problems.
Try using /NOUNLOAD on destroy but make sure you call destroy again without /NOUNLOAD in .onGUIEnd otherwise the plugin will not be deleted.
Stu
lybra
9th May 2007 12:19 UTC
The /NOUNLOAD on destroy doesn't work. Thanks for your help by the way (usually if you start answering in a topic, the problem is quickly resolved, so I have high hopes & expectations :-))
I found another freaky thing during testing. First: I accidentally put the .NET 1.1 redistributable in the REDISTRIBUTABLES_FOLDER, so that is the one causing the hang-up. I replaced it with the .NET 2.0 installer and then my installer works;, however a DirectX installer makes it hang again. Difference is that the .NET 2.0 installer is not immediately cancellable (you get a number of screens before the installer closes), and the other two installers are immediately closed if you press Cancel.
I'm using NSIS 2.11.
If you want, I can attach my two source files?
kichik
23rd May 2007 15:38 UTC
Have you tried with NSIS 2.27? Does it happen on more than one computer? Can you attach a simple script that reproduces this? I can't reproduce it with some random installers I had laying around.
lybra
31st May 2007 14:53 UTC
I'm sorry for my late response, I was on (a well-deserved :-)) holiday.
Attached you'll find my testfiles. You'll also need the .NET 1.1 redistributable in the REDISTRIBUTABLES_FOLDER (set in .onInit).
Steps to reproduce:
- Run the installer.
- When the .NET installer asks "Would you like to install Microsoft .NET Framework 1.1 Package?", press No.
- The installer freezes.
Also notice:
- The same code on the main page does not freeze (you can see this by commenting out the custom Page command in MyTestInstaller.nsi.
- If you enable the MessageBox statement in function InstallDotNet in MyTestCustomPage.nsh, you'll find that it won't freeze.
I won't have time to test much this week, but I'll install NSIS 2.27 on a different computer early next week.
kichik
13th June 2007 21:20 UTC
Haven't had a chance to test your program or try reproducing it myself but I think I've found something. Let me know if the attached Banner solves this.
lybra
14th June 2007 11:54 UTC
I have tested the new banner, but unfortunately the result is the same. I have tested this with the latest version (2.28).
I did find something interesting though. In the current implementation, I call the .NET installer in the page creator function.
<MyTestInstaller.nsi>
Page custom ShowMyTestCustomPage
<MyTestCustomPage.nsh>
Function ShowMyTestCustomPage
...
Call InstallDotNet
FunctionEnd
However, if I change this code to call the .NET installer from the page leave function, it works just fine.
<MyTestInstaller.nsi>
Page custom ShowMyTestCustomPage LeaveMyTestCustomPage
<MyTestCustomPage.nsh>
Function ShowMyTestCustomPage
...
; Call InstallDotNet
FunctionEnd
Function LeaveMyTestCustomPage
Call InstallDotNet
FunctionEnd
This doesn't explain to me why it does work in the page creator function when I add a message box, but as a workaround it'll do just fine.
kichik
16th June 2007 12:53 UTC
Here's a version that works with your test case. It has better synchronization methods. I still need to figure out what exactly went wrong with the original one.
lybra
18th June 2007 10:27 UTC
@kichik: thanks, the new banner works perfectly! :up: If you need me to further test anything, let me know.
kichik
26th June 2007 20:01 UTC
Well, I managed to freeze the new Banner on my first try. So my next guess was correct and it's indeed the frozen message loop in the main thread.
I've now implemented the message loop where it's needed and also uploaded it to CVS. I've also attached the compiled version here. Please test it and let me know if it works fine for you too.
lybra
28th June 2007 16:22 UTC
This latest banner also works fine for me! Thanks for all the effort.
bobics
29th June 2007 00:59 UTC
This appears to have fixed the banner hanging in my installer script also. I only started noticing this problem when launching an executable during the banner... whereas before I had a placeholder since we didn't have the exe implementation finished yet. In case it helps, in my script the banner is being displayed in the Component Leave callback, i.e.:
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE verifyComponentReqs
!insertmacro MUI_PAGE_COMPONENTS
Thank you for the fix.