Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: fa646db1e40fec3b32870094ef211945bff31367
Ticket: 1960724fffffffffffffffffffffffffffffffff
crash calling a method
User & Date: pertronic on 2008-05-09 04:25:08
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    # winXP, TclOO 0.2 Tcl 8.5.2
    
    The following crashes on the "internal" call to copy.
    The crash is sensitive to the number of object properties, e.g. if "my variable np_name" is removed from the constructor there is no crash.
    
    
    package require TclOO
    namespace import oo::*
    
    class create A {
    
    constructor {name} {
    my variable np_name 
    set np_name $name
    }
    
    #
    # make a deep copy
    #
    method copy {nm} {
    set cpy [[info object class [self]] new $nm]
    foreach var [info object vars [self]] {
    my variable $var
    set val [set $var]
    if {[string match o_* $var]} {
    set objs {}
    foreach ref $val {
    # call to "copy" crashes
    lappend objs [$ref copy {}]
    }
    $cpy prop $var $objs
    } else { 
    $cpy prop $var $val
    }
    }
    return $cpy
    }
    
    method prop {name val} {
    my variable $name
    set $name $val
    }
    }
    
    
    set o1 [A new {}]
    set o2 [A new {}]
    $o1 prop o_object $o2
    $o1 copy aa
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "pertronic"
  10. subsystem changed to: "35. TclOO Package"
  11. title changed to: "crash calling a method"
  12. type changed to: "Bug"