Tk Library Source Code

View Ticket
Login
Ticket UUID: 1390477
Title: snit can destroy errorInfo in some cases
Type: Patch Version: None
Submitter: amonarch Created on: 2005-12-26 11:06:05
Subsystem: snit Assigned To: duquette
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2013-07-04 17:25:43
Resolution: Not Applicable Here Closed By:
    Closed on:
Description:
  Sometimes snit functions can be called from
exception processing code:

if {[catch {some_code }]} {
        exception processing code
        here snit called
        ...
}

  It's possible in non evident way, for example,
then executed the following code:

proc procedure1 {...} {
   set varname snit_object
   trace add variable varname {snit_object destroy}
   ....
}

  (this technique used in oomk -- http://www.equi4.com)

  When error occurs in procedure1, trace code will be
called, which invokes snit destructor. But SNIT CAN
DESTROY ::errorInfo and ::errorCode GLOBAL VARIABLES
in many cases. As for example, when snit calls any
method, including destructor. And you get obscure
error message. Because snit's code abound with
constructions like following:

   if {[catch {set snit_var} result]} {
          blablabla...
   }

Here, if snit_var is not defined, errorInfo will be
corrupted with message like
"Snit_typemethodCache($mehod) -- no such variable"...

  This patch *partially* corrects described problems.
("catch" not used there possible or ::errorInfo and
::errorCode there possible preserved).
In some cases, then real error occurs in snit, there
are no solution where old value of errorInfo can be
stored. This is not snit bug, but tcl defect, as I
think. :-(
User Comments: amonarch added on 2005-12-26 18:07:00:

File Added - 161102: snit.diff

Attachments: