For Programmers: Free Programming Magazines  


Home > Archive > Tcl > July 2004 > [Urgent :-)] How to cancel the effect of upvar?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [Urgent :-)] How to cancel the effect of upvar?
George Petasis

2004-07-20, 8:58 pm

Hi all,

My problem involves itcl & upvar. I have a class

class test {
variable array_var

constructor {mirror_obj} {
if {[string length $mirror_obj]} {
upvar "@itcl $mirror_obj array_var" \
[itcl::scope array_var]
} else {
# initialise array_var as a table
}
}
}

If I create an object A and an object B using A as mirror_obj,
object B upvars the array of object A as its array_var. I am doing this
because I want the same array to be shared between two objects.
However, I get random crashes during the deletion of such objects.
Unsetting the array_var variable in the constructor does not help
much (after all this is what itcl also does internally). Any idea
on how to cancel the effect of upvar? Isn't itcl supposed to handle
such a situation automatically?

George

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com