| Description: |
I think there is a bug in Widget::init, line 66 (4th
from below): set pathopt($option)
[$Widget::_optiontype($type) $option $value [lindex
$optdesc 3]].
The command that gets executed can throw an exception
for example if an invalid value for an Enum is passed.
This exception should be caught to unset pathopt and
pathmod. As it is now, I am tempted to call this a
memory leak.
Example run showing the bug:
wish
% package require BWidget
1.7
% LabelFrame .lblf -side foo
bad side value "foo": must be left, right, top or bottom
% namespace eval ::Widget::LabelFrame {puts stderr
[lsort [info vars]]}
.lblf:mod .lblf:opt argc argv argv0 auto_index
auto_oldpath auto_path env errorCode errorInfo map
map.f map.l map:cmd opt optionClass optionExports sync
tcl_interactive tcl_libPath tcl_library tcl_patchLevel
tcl_pkgPath tcl_platform tcl_rcFileName tcl_version
tk_library tk_patchLevel tk_strictMotif tk_version
Solution:
if [catch {$Widget::_optiontype($type) $option $value
[lindex $optdesc 3]} msg] {
if { [info exists pathopt] } {
unset pathopt
}
unset pathmod
return -code error "$msg"
} else {
set pathopt($option) "$msg"
}
|