ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> incrtcl-develop
incrtcl-develop
[Incrtcl-develop] [ incrtcl-Bugs-1440882 ] bug in destructor chaining
by SourceForge.net other posts by this author
Mar 1 2006 2:48AM messages near this date
[Incrtcl-develop] [ incrtcl-Bugs-1468370 ] Abnormal termination / related to Bug#227814 | [Incrtcl-develop] Call For Papers: 13th Annual Tcl/Tk Conference, Oct. 9-13, 2006
Bugs item #1440882, was opened at 2006-03-01 10:47
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=113244&aid=1440882&group_id=13244

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Other
Group: cvs-HEAD
Status: Open
Resolution: None
Priority: 5
Submitted By: Tony Borthwick (aborthwi)
Assigned to: David Gravereaux (davygrvy)
Summary: bug in destructor chaining

Initial Comment:
first submitted as bug 1664491

destructor chaining doesn't work when any of the class
names in the inheritance tree have the same "short"
name (ie. the not fully qualified name), e.g.

$ cat example.tcl
package require Itcl

namespace eval ::Vanilla {
::itcl::class IceCream {
destructor {
puts "$this [namespace current]-> destructor"
}
}
}

namespace eval ::Strawberry {
::itcl::class IceCream {
inherit ::Vanilla::IceCream
destructor {
puts "$this [namespace current]-> destructor"
}
}
}

set a [::Vanilla::IceCream #auto]
set b [::Strawberry::IceCream #auto]
::itcl::delete object $a
::itcl::delete object $b
$ tclsh example.tcl
::iceCream0 ::Vanilla::IceCream-> destructor
::iceCream1 ::Strawberry::IceCream-> destructor

The ::Vanilla::IceCream-> destructor is not being called
when a ::Strawberry::IceCream instance is deleted. The
expected output should be:

::iceCream0 ::Vanilla::IceCream-> destructor
::iceCream1 ::Strawberry::IceCream-> destructor
::iceCream1 ::Vanilla::IceCream-> destructor

The problem occurs in itcl 3.2.1 and 3.3

The "destructed" table used to keep track of which
destructors have been invoked (contextObj-
> destructed) is keyed on contextObj->classDefn->name
(the short name of the class), which works fine if
classes are uniquely named across all namespaces. The
problem is fixed if contextObj-> classDefn->fullname is
used instead. The functions that need to be changed
are:

ItclDestructBase (RCS: $Id: itcl_objects.c,v 1.13
2003/12/23 03:11:04 davygrvy Exp $)
Itcl_EvalMemberCode (RCS: $Id: itcl_methods.c,v 1.12
2003/12/24 01:09:56 davygrvy Exp $)

$ diff itcl_objects.c itcl_objects.c.orig
443c443
< if (!Tcl_FindHashEntry(contextObj-> destructed,
contextClass-> fullname)) {
---
>  if (!Tcl_FindHashEntry(contextObj->destructed,
contextClass-> name)) {

$ diff itcl_methods.c itcl_methods.c.orig
1019c1019
< member-> classDefn->fullname, &newEntry);
---
>  member->classDefn->name, &newEntry);

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=113244&aid=1440882&group_id=13244


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Incrtcl-develop mailing list
Incrtcl-develop@[...].net
https://lists.sourceforge.net/lists/listinfo/incrtcl-develop

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved