View Single Post
Old 3rd March 2016, 13:10   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,316
Why did you not comment things out until you found the line with the actual problem? Not everything works when called on a background thread because NSIS and plugins were never designed to do this. You are also missing a lot of Pop's in your code.

I can't get it to crash:
PHP Code:
Page Custom MyPage 
Page InstFiles 

!include nsDialogs.nsh 
!include LogicLib.nsh 



Function aaply
    nsExec
::Exec "taskkill /F /T /IM MyApp.exe"
    
#Pop ??
    
WriteINIStr "$pluginsdir\Config.ini" License LicenseKey $8
    nsExec
::ExecToStack "net stop MyAppApache /Y"
    
#Pop $0
    #Pop ??
    #MessageBox mb_ok |$0|
FunctionEnd

Function Crash 
Pop 
$7
EnableWindow 
$7 0
System
::Call KERNEL32::GetTickCount()i.r0
${NSD_SetText} $$0
GetFunctionAddress 
$0 aaply
BgWorker
::CallAndWait
EnableWindow 
$7 1
FunctionEnd 

Function Generate 
Pop 
$0
EnableWindow 
$8 0
System
::Call KERNEL32::GetTickCount()i.r0
${NSD_SetText} $$0
System
::Call USER32::UpdateWindow(i$9) ; Comment out this for slow updates
Sleep 3333
EnableWindow 
$8 1
FunctionEnd 


Function MyPage 
nsDialogs
::Create 1018 
Pop 
$
${NSD_CreateText0 10u 10012u "" 
Pop $9
${NSD_CreateBrowseButton0 30u 10012u "Works"
Pop $8
${NSD_OnClick} $8 Generate 
${NSD_CreateBrowseButton0 50u 10012u "Crash?"
Pop $0
${NSD_OnClick} $0 Crash 
nsDialogs
::Show 
FunctionEnd 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote