Archive: [BUG] System Plugin issue with SetDetailsPrint lastused


[BUG] System Plugin issue with SetDetailsPrint lastused
  First off, I posted a bug report ticket already but I decided to also post a copy on the forums to let others know.

In a nutshell if I use the system plugin after calling

SetDetailsPrint none
, then
SetDetailsPrint lastused
has no effect.

Here is a sample that reproduces the issue on my system.
## Compiled using MakeNSIS v2.46


>OutFile "System Plugin - SetDetailsPrint ***91;Bug***93;.exe"
>ShowInstDetails show

Section Main

DetailPrint "This is displayed"

Call SetDetailsPrintTest

DetailPrint "This should be displayed but dosn't!"

>SectionEnd

>Function SetDetailsPrintTest
SetDetailsPrint none

Push$0
System
::Alloc 8
Pop$0

DetailPrint "This is not displayed"

System::Free $0

## FIXME This should revert to the default DetailsPrint mode but has no effect
SetDetailsPrint lastused
FunctionEnd
>

Here is a macro for a temporary work around.


macro _SetDetailsPrint _VALUE

## There is a bug that prevents lastused from working on the 2.46 version of NSIS
## I'm hoping this will be fixed in the next version
## ***91;url***93;http://sourceforge.net/tracker/?func=detail&aid=2969695&group_id=22049&atid=373085***91;/url***93;
!if ${_VALUE} == lastused
!ifndef NSIS_VERSION_MAJOR & NSIS_VERSION_MINOR
!searchparse ${NSIS_VERSION} "v" NSIS_VERSION_MAJOR `.` NSIS_VERSION_MINOR
!endif
!if ${
NSIS_VERSION_MAJOR}.${NSIS_VERSION_MINOR} > 2.46
!warning `***91;BUG WORKAROUND SKIPPED***93; - If any following "DetailPrint" operations Fail try setting "SetDetailsPrint" manually.`
SetDetailsPrint lastused
!else
!warning `***91;BUG WORKAROUND APPLIED***93; - "SetDetailsPrint" set to "both" and not "lastused"`
SetDetailsPrint both
!endif
!else
SetDetailsPrint ${_VALUE}
!endif
!macroend
>!define SetDetailsPrint `!insertmacro _SetDetailsPrint`
EXAMPLE

none

>${SetDetailsPrint} lastused
>

This is not specific to the system plugin.

There might be some memory corruption going on that resets the lastused state, or maybe the codepath that handles plugin commands sets the detailprint state.