Menu

#268 Destructor error corrupts object

4.0*
closed-fixed
None
5
2015-12-09
2015-11-03
No

When a destructor error occurs, the object becomes corrupted. For example:

package require Itcl

itcl::class Temp {

    private variable a

    destructor {
        error destructor
    }

    public method A {} {
        set a 0           ;# <-------- fails
        puts "a = $a"
    }
}

set obj [Temp #auto]
catch {itcl::delete object $obj}
$obj A

In Itcl 3.4, this prints:

a = 0

In Itcl 4.0.3, it generates the error:

can't set "a": upvar refers to variable in deleted namespace

Discussion

  • Don Porter

    Don Porter - 2015-11-30

    Confirmed. Suspect it's another symptom of the overall
    design botch of implementing variables as references to
    a ....::internal::.... namespace.

     
  • Don Porter

    Don Porter - 2015-12-09

    fixed on trunk

     
  • Don Porter

    Don Porter - 2015-12-09
    • status: open --> closed-fixed
    • assigned_to: Don Porter
     

Log in to post a comment.