Old 8th May 2007, 13:40   #1
lybra
Junior Member
 
Join Date: Dec 2005
Posts: 25
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:
code:
; 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.
lybra is offline   Reply With Quote
Old 8th May 2007, 15:38   #2
goldy1064
Senior Member
 
Join Date: Jun 2005
Posts: 211
You could try ensuring that the current working directory is set to $PLUGINSDIR before doing calls to the banner plugin.
code:

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

goldy1064 is offline   Reply With Quote
Old 8th May 2007, 15:39   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Use InitPluginsDir for that.

Stu
Afrow UK is offline   Reply With Quote
Old 9th May 2007, 06:23   #4
lybra
Junior Member
 
Join Date: Dec 2005
Posts: 25
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.

code:
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

lybra is offline   Reply With Quote
Old 9th May 2007, 10:29   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 9th May 2007, 11:19   #6
lybra
Junior Member
 
Join Date: Dec 2005
Posts: 25
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?
lybra is offline   Reply With Quote
Old 23rd May 2007, 14:38   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 31st May 2007, 13:53   #8
lybra
Junior Member
 
Join Date: Dec 2005
Posts: 25
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.
Attached Files
File Type: zip mytestinstaller.zip (1.1 KB, 436 views)
lybra is offline   Reply With Quote
Old 13th June 2007, 20:20   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.
Attached Files
File Type: zip banner.zip (1.5 KB, 509 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 14th June 2007, 10:54   #10
lybra
Junior Member
 
Join Date: Dec 2005
Posts: 25
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.

code:

<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.

code:

<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.
lybra is offline   Reply With Quote
Old 16th June 2007, 11:53   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.
Attached Files
File Type: zip banner.zip (1.6 KB, 486 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th June 2007, 09:27   #12
lybra
Junior Member
 
Join Date: Dec 2005
Posts: 25
@kichik: thanks, the new banner works perfectly! If you need me to further test anything, let me know.
lybra is offline   Reply With Quote
Old 26th June 2007, 19:01   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.
Attached Files
File Type: zip banner.zip (1.5 KB, 484 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 28th June 2007, 15:22   #14
lybra
Junior Member
 
Join Date: Dec 2005
Posts: 25
This latest banner also works fine for me! Thanks for all the effort.
lybra is offline   Reply With Quote
Old 28th June 2007, 23:59   #15
bobics
Junior Member
 
Join Date: May 2006
Location: San Francisco, CA
Posts: 25
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.
bobics is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump