Tk Library Source Code

View Ticket
Login
Ticket UUID: 1532791
Title: snit2, snit::widget problem
Type: Bug Version: None
Submitter: andreas_kupries Created on: 2006-08-01 22:40:52
Subsystem: snit Assigned To: duquette
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-08-16 09:05:36
Resolution: Fixed Closed By: duquette
    Closed on: 2006-08-16 02:05:36
Description:
When using 'variable' to define components snit 2.0 has
a problem if the component has delegates set on it, and
the delegates are defined before the component.

When trying to create an instance snit crashes with the
attached stacktrace.

The reason is that the 'variable' statement coming
after the delegation cause snit to insert assignments
to the relevant instance variables, after the delegates
have set up traces. The trace is triggered, and comes
ultimatively to RT.ClearInstanceCaches, which accesses
the internal Snit_instance variable. At a time when
this variable is not defined yet. This happens a few
lines later, via installhull.

The relevant lines in snit2.tcl are 1906, which runs
the assignments triggering the trace accessing the
variable, and 1922, where the variable is defined.

Workarounds for this problem are to either move the
'variable' declarations before the delegation setup, or
to use the 'component' command. The latter apparently
has additional intelligence about delegation which
prevents it from inserting the additional assignments
into the generated Snit_instanceVars hook procedure.
User Comments: duquette added on 2006-08-16 09:05:36:
Logged In: YES 
user_id=372859

This has been fixed, and test "bug-3.1" has been added to the Snit test suite to 
cover the error condition.

andreas_kupries added on 2006-08-02 05:40:53:

File Added - 187209: snit_bug.txt

Attachments: