Tcl Source Code

View Ticket
Login
Ticket UUID: 1512138
Title: Signal obj deletion vs. shimmering: tests missing
Type: Bug Version: None
Submitter: msofer Created on: 2006-06-25 14:25:45
Subsystem: 10. Objects Assigned To: msofer
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2011-04-12 09:44:57
Resolution: Accepted Closed By: msofer
    Closed on: 2011-04-12 02:44:57
Description:
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.
User Comments: msofer added on 2011-04-12 09:44:56:

allow_comments - 1

msofer added on 2008-06-28 23:01:05:

data_type - 110894

Logged In: YES 
user_id=148712
Originator: YES

Moving to bugs for the missing tests

msofer added on 2006-10-02 17:46:49:
Logged In: YES 
user_id=148712

Missing tests in the testsuite!

msofer added on 2006-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.

msofer added on 2006-09-30 21:28:09:
Logged In: YES 
user_id=148712

The tclcore thread is at
http://aspn.activestate.com/ASPN/Mail/Message/3168511

dkf added on 2006-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 added on 2006-06-25 21:25:46:

File Added - 182927: signalDeletion.patch

Attachments: