Skip to content
⌘ NSIS Forum Archive

[BUG] System Plugin issue with SetDetailsPrint lastused

3 posts

Zinthose#

[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 [Bug].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 
Zinthose#
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
    ##   [url]http://sourceforge.net/tracker/?func=detail&aid=2969695&group_id=22049&atid=373085[/url]
    !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 `[BUG WORKAROUND SKIPPED] - If any following "DetailPrint" operations Fail try setting "SetDetailsPrint" manually.`
            SetDetailsPrint lastused
        !else
            !warning `[BUG WORKAROUND APPLIED] - "SetDetailsPrint" set to "both" and not "lastused"`
            SetDetailsPrint both
        !endif
    !else
        SetDetailsPrint ${_VALUE}
    !endif
!macroend
!define SetDetailsPrint `!insertmacro _SetDetailsPrint` 
EXAMPLE
${SetDetailsPrint} none
${SetDetailsPrint} lastused 
Anders#
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.