From 620d7ef6b19e41faef5f92f98c1fa4e298d681fe Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Sun, 5 Feb 2023 19:48:43 -0500 Subject: c-statements: More handle cleanup. Animal test works Main bug was setting up rtype with ckalloc instead of Tcl_NewObj, which resulted in weird refcount reuse behavior. --- lib/c.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/c.tcl b/lib/c.tcl index 27b7a2cb..39e2fdd3 100644 --- a/lib/c.tcl +++ b/lib/c.tcl @@ -254,7 +254,7 @@ namespace eval c { variable rtypes rtype $type { - $robj = ckalloc(sizeof(struct Tcl_Obj)); + $robj = Tcl_NewObj(); $robj->bytes = NULL; $robj->typePtr = &$[set rtype]_ObjType; $robj->internalRep.otherValuePtr = ckalloc(sizeof($[set rtype])); @@ -363,7 +363,7 @@ namespace eval c { # puts "=====================\n$sourcecode\n=====================" set cfd [file tempfile cfile cfile.c]; puts $cfd $sourcecode; close $cfd - exec cc -Wall -g -shared -fsanitize=address -fPIC {*}$cflags $cfile -o [file rootname $cfile][info sharedlibextension] + exec cc -Wall -g -shared -fPIC {*}$cflags $cfile -o [file rootname $cfile][info sharedlibextension] load [file rootname $cfile][info sharedlibextension] cfile } ::proc import {scc sname as dest} { -- cgit v1.2.3