infinitе loop in freeIntRepProc()

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

infinitе loop in freeIntRepProc()

Charlie Root

I am sorry for my english.
I get infinite loop in freeIntRepProc(), if condition "obj == Tcl_GetObjResult(interp)" is true.

I want to write proc "typedef" and to define new types in tcl code. For example:


load ./typedef.so typedef

# typedef <type name> <constructor args> <constructor body> <destructor body>
typedef xxx {a b} {
    set x [list $a $b]
    puts "ctor: $x"
    return $x
} {
    puts "dtor: $this"

proc main {} {
    xxx 1 2


This approach shall cause a destructor call in case of automatic destruction of variable.

Code looped forewer if destroied object and interp result object are same.


 94                 case 1:
 95                         assert(obj == Tcl_GetObjResult(TCLOBJ_INTERP(*obj)));
 96                         obj->refCount++;
 97                         Tcl_ResetResult(TCLOBJ_INTERP(*obj));
 98                         obj->refCount--;
 99                         break;

This fradment of code solve trouble, but it looks as hack.

In my modest opinion TCL shall add similar hack to freeIntRepProc call () self.


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Tcl-Core mailing list
[hidden email]

typedef.c (7K) Download Attachment