Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-14
03:16 • Ticket [217978ffff] interp hide, invokehidden bug status still Closed with 3... artifact: 8ad0c03e9a user: dgp
2000-10-26
08:12 • Closed ticket [217978ffff]. artifact: 9b2f8d8ee9 user: welch
00:47 • New ticket [217978ffff]. artifact: 327538d7ae user: nobody

interp hide, invokehidden bug

Closed / Fixed217978ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:47:05
OriginalBugID: 5373 Bug
Version: 8.3.1
SubmitDate: '2000-05-05'
LastModified: '2000-06-25'
Severity: MED
Status: Closed
Submitter: techsupp
ChangedBy: ericm
RelatedBugIDs: 5845
OS: Solaris
OSVersion: solaris2.6, linux2.x
Machine: sun-ultra5, pentium 686
FixedDate: '2000-06-25'
ClosedDate: '2000-10-25'


Name:
Hemang Lavana

ReproducibleScript:
I am experimenting with the "interp hide" and "interp invokehidden"
commands. I do the following (see the attached example script):
  1. create a child interpreter
  2. load Tk package into the child interpreter
  3. hide the "button" command
  4. create an alias to a proc, called "button" in child interpreter,
      that uses "interp invokehidden" command to invoke the
      original (hidden) button command. It also prints a message
      to stdout whenever button command is called
  5. Create and pack buttons in the child interpreter.

----------------------
# interphide.tk

#wm iconify .
set iid [interp create]
load {} Tk $iid

set tkcmds "button label"

foreach cmd $tkcmds {
  $iid hide $cmd
  $iid alias $cmd createWidget $iid $cmd
}

proc createWidget {iid cmd pathname args} {
  set ret [uplevel 1 $iid invokehidden $cmd $pathname $args]
  puts stdout "$cmd $pathname $args, RETURNS=$ret."
  $iid hide $pathname
  $iid alias $pathname invokePathname $iid $pathname
  return $ret
} ;# End of proc createWidget

proc invokePathname {iid pathname args} {
  set ret [uplevel 1 $iid invokehidden $pathname $args]
  puts stdout "$pathname $args, RETURNS=$ret."
  return $ret
} ;# End of proc invokePathname

$iid eval {
  pack [button .b1 -text "Button B1" -command {puts .b1}]
  pack [button .b2 -text "Button B2" -command {puts .b2}]
#  pack [label .l1 -text "label 1"]
#  pack [label .l2 -text "label 2"]
}
# interphide.tk

#wm iconify .
set iid [interp create]
load {} Tk $iid

set tkcmds "button label"

foreach cmd $tkcmds {
  $iid hide $cmd
  $iid alias $cmd createWidget $iid $cmd
}

proc createWidget {iid cmd pathname args} {
  set ret [uplevel 1 $iid invokehidden $cmd $pathname $args]
  puts stdout "$cmd $pathname $args, RETURNS=$ret."
  $iid hide $pathname
  $iid alias $pathname invokePathname $iid $pathname
  return $ret
} ;# End of proc createWidget

proc invokePathname {iid pathname args} {
  set ret [uplevel 1 $iid invokehidden $pathname $args]
  puts stdout "$pathname $args, RETURNS=$ret."
  return $ret
} ;# End of proc invokePathname

$iid eval {
  pack [button .b1 -text "Button B1" -command {puts .b1}]
  pack [button .b2 -text "Button B2" -command {puts .b2}]
#  pack [label .l1 -text "label 1"]
#  pack [label .l2 -text "label 2"]
}
-----------------------------

When I invoke this script with wish8.3.1, I get a segmentation fault/bus
error if I try to create more than one button. I do not get this errror, when
invoked with wish8.0.5.

u11> uname -a
SunOS hlavana-u5 5.6 Generic_105181-10 sun4u sparc SUNW,Ultra-5_10

u12> wish8.3 interhide.tk
button .b1 -text {Button B1} -command {puts .b1}, RETURNS=.b1
Bus error

u13> wish8.0 interphide.tk
button .b1 -text {Button B1} -command {puts .b1}, RETURNS=.b1
button .b2 -text {Button B2} -command {puts .b2}, RETURNS=.b2
^C
u14>

ObservedBehavior:
The "interp invokehidden" creates a bus error, whenever more than one button is
created in the child interpreter. Similar results occur for other widgets too - I have
observed this behavior for with "label" widget.

This behavior is also noticed on linux2.x version (I don't recall the exact version number,
but it was linux-mandrade 7.0). I have not tested on winNT/9x yet.

DesiredBehavior:
No "segmentation fault/bus error".
welch Closed ticket [217978ffff]. [History diff]2000-10-26 08:12:09
dgp Ticket [217978ffff]: 3 changes [History diff]2001-04-14 03:16:47
Log in (anonymous is fine) to add a comment.