Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Signal obj deletion vs. shimmering: tests missing

Closed / Accepted1512138fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 16 years ago
Descriptionplain2006-06-25 14:25:45
In a discussion on TCLCORE, jcw requested the
possibility to determine if the obj is being deleted or
shimmered when he receives a cal to its freeIntRepProc
(a link to the discussion will be added here when the
tclcore archives return online).

This patch implements this possibility by insuring that
on deletion the string rep is invalidated first, and
indicating the fact that the string rep is invalid by a
negative length. Note that a NULL string rep cannot be
used to signal this fact, as the bytes field is
currently used to implement the deletion stack.

A negative length will always indicate that the object
is being freed:
   - if the obj is being freed, the stringrep is always
invalidated and the length set to -1 before calling the
freeIntRepProc
   - if the obj is being shimmered, the setFromAnyProc
of the new type will have insured that a string rep is
available before freeing the old intrep.

This looks pretty safe and cheap to me; requesting
review by dkf before commit.
msoferplain2006-06-25 21:25:46
File Added - 182927: signalDeletion.patch
dkfplain2006-06-30 15:14:35
Logged In: YES 
user_id=79902

Patch looks OK modulo one or two comment-formatting points,
but please add a function (exported through tclInt.decls)
for checking whether an object is being deleted. This will
help to ensure that extensions do not encode the information
that length==-1 is magical, and should prevent pain later on.
msofer Ticket [1512138fff]: 1 change [History diff]2006-09-30 01:04:44
msoferplain2006-09-30 21:28:09
Logged In: YES 
user_id=148712

The tclcore thread is at
http://aspn.activestate.com/ASPN/Mail/Message/3168511
msoferplain2006-10-01 02:01:58
File Added - 196009: signalDeletion.patch

Logged In: YES 
user_id=148712

Revised patch committed, provides the new function
  int TclObjBeingDeleted(Tcl_Obj *objPtr)
in the internal stubs table.
msoferplain2006-10-02 17:46:49
Logged In: YES 
user_id=148712

Missing tests in the testsuite!
msoferplain2008-06-28 23:01:05
data_type - 110894

Logged In: YES 
user_id=148712
Originator: YES

Moving to bugs for the missing tests
msofer Ticket [1512138fff]: 1 change [History diff]2009-05-01 08:20:50
msofer Ticket [1512138fff]: 1 change [History diff]2009-12-11 10:18:28
msoferplain2011-04-12 09:44:56
allow_comments - 1
msofer Ticket [1512138fff]: 2 changes [History diff]2011-04-12 09:44:57
Log in (anonymous is fine) to add a comment.

Attachments: