Skip to content

Commit

Permalink
Check state is defined before unset in unsetState
Browse files Browse the repository at this point in the history
  • Loading branch information
xdelaruelle committed Jul 30, 2022
1 parent b9af6a6 commit a2c3b76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
4 changes: 1 addition & 3 deletions tcl/envmngt.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,7 @@ proc renderSettings {} {
}

setState shell [getState modtosh_real_shell]
if {[isStateDefined shelltype]} {
unsetState shelltype
}
unsetState shelltype
}

# return text value if defined even if error happened
Expand Down
6 changes: 4 additions & 2 deletions tcl/init.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ proc getState {state {valifundef {}} {catchinitproc 0}} {

# Clear state
proc unsetState {state} {
unset ::g_states($state)
reportDebug "$state unset"
if {[isStateDefined $state]} {
unset ::g_states($state)
reportDebug "$state unset"
}
}

# Set state value
Expand Down
12 changes: 3 additions & 9 deletions tcl/report.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,7 @@ proc reportFlush {} {
report "[join $dispmsglist ,] \]"
}
# inhibit next content separator if output is ending
if {[isStateDefined report_sep_next]} {
unsetState report_sep_next
}
unsetState report_sep_next
report \}
}
Expand Down Expand Up @@ -978,12 +976,8 @@ proc popMsgRecordId {{setmsgid 1}} {
}
proc clearAllMsgRecordId {} {
if {[isStateDefined evalid]} {
unsetState evalid
}
if {[isStateDefined msgrecordid]} {
unsetState msgrecordid
}
unsetState evalid
unsetState msgrecordid
}
#
Expand Down
4 changes: 1 addition & 3 deletions tcl/subcmd.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -2641,9 +2641,7 @@ proc cmdModuleModToSh {shell args} {
reportErrorAndExit "Unsupported shell type \'$shell\'"
}
setState shell $shell
if {[isStateDefined shelltype]} {
unsetState shelltype
}
unsetState shelltype

# silence message report (avoid mix with produced shell code) unless if
# a debugging mode is set
Expand Down

0 comments on commit a2c3b76

Please sign in to comment.