Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-08-21
03:14 • Closed ticket [450545ffff]: unregistered ObjType's okay plus 6 other cha... artifact: de2c3f28c5 user: hobbs
2001-08-15
22:45 • Ticket [450545ffff]: 5 changes artifact: 7649732e34 user: dkf
22:39 • Ticket [450545ffff]: 4 changes artifact: 1efde7cd76 user: dgp
22:35 • Ticket [450545ffff]: 4 changes artifact: cffa7910bb user: dkf
22:03 • Ticket [450545ffff]: 4 changes artifact: a4c0bcf3b3 user: dgp
16:25 • Ticket [450545ffff]: 4 changes artifact: ba23db59e4 user: dkf
16:24 • Ticket [450545ffff]: 4 changes artifact: 4408a63af4 user: dkf
16:24 • Ticket [450545ffff]: 4 changes artifact: 27c5f64475 user: dkf
16:24 • Add attachment tkobj.patch to ticket [450545ffff] artifact: 49e0bc1813 user: dkf
02:28 • Ticket [450545ffff] unregistered ObjType's okay status still Open with 4... artifact: f2202de8d5 user: dgp
2001-08-14
18:52 • Ticket [450545ffff]: 5 changes artifact: c58fb12ed1 user: msofer
17:00 • Ticket [450545ffff]: 4 changes artifact: a03897c36a user: dkf
17:00 • Ticket [450545ffff]: 4 changes artifact: b1d065853e user: dkf
04:30 • Ticket [450545ffff]: 4 changes artifact: 0a2f987521 user: dgp
2001-08-13
17:31 • New ticket [450545ffff]. artifact: 4016be8f52 user: stevenashe

unregistered ObjType's okay

Closed / Fixed450545ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-08-13 17:31:34
Tcl_ObjType(3) states that writers of new object types
need to
call tcl_RegisterObjType.  tk, for one, does not do
this
with any of the ObjTypes it manipulates.  It certainly
is not
self-evident that extensions can maintain private
Object
types unknown to the tcl core.  If maintaining private
Object types is considered legal,  then the Tcl_Obj(3)
man page
should state this.

For example, tcl might decide to verify that typePtr in
the
Tcl_Obj structure is something valid, possibly by
checking
against the registered types.  This would break tk.
dgpplain2001-08-14 04:30:48
Logged In: YES 
user_id=80530


I agree with this report that Tk ought to
register its Tcl_ObjType's with appropriate
calls to Tcl_RegisterObjType.  This would
allow things like Tcl_ConvertToType to work
with the Tk types.

From that perspective, this is a Tk bug.
dkfplain2001-08-14 17:00:08
Logged In: YES 
user_id=79902

Here's a patch to fix Tk by registering all its object types
dkfplain2001-08-14 17:00:09
File Added - 9520: tkobj.patch
msoferplain2001-08-14 18:52:06
Logged In: YES 
user_id=148712

Comments and patch clearly mark this as a Tk bug. Jeff, I'm
passing the ball to you :)
dgpplain2001-08-15 02:28:50
Logged In: YES 
user_id=80530


The Tcl_ObjType's that are no longer static
after this patch is applied -- shouldn't
they be renamed to have a "tk" prefix?
dkfplain2001-08-15 16:24:45
Logged In: YES 
user_id=79902

That's a much larger change, and Tk wasn't exactly clean in
that respect either.  Still, here's a revised version (which
is also unfortunately a much larger patch...)
dkfplain2001-08-15 16:24:46
File Added - 9564: tkobj.patch
dkfplain2001-08-15 16:25:15
File Deleted - 9520:
dgpplain2001-08-15 22:03:54
Logged In: YES 
user_id=80530


Much better.  One more question:  should the new
internal function TkRegisterObjTypes() go into
the internal stub table ?  How does one decide
whether a new non-static internal function goes
in the internal stub table or not?
dkfplain2001-08-15 22:35:21
Logged In: YES 
user_id=79902

I don't think its useful to put TkRegisterObjTypes() in the
stub table; it only really needs calling when Tk is first
loaded (currently it is called immediately after stub table
initialisation IIRC, which should be good enough.)  Calling
it again will just keep the reinit the types to the same
value, which ought to be harmless enough...
dgpplain2001-08-15 22:39:42
Logged In: YES 
user_id=80530

So membership in the internal stub table is just a
judgment call, then?  In that case, I agree it's
not helpful to put it in.

The patch looks good.  I've applied it and no new
test failures result.  If you're looking for 
approval for commit, you've got it from me.
dkfplain2001-08-15 22:45:25
Logged In: YES 
user_id=79902

Checked in.  I'll let Jeff figure out whether to close this
bug... :^)
hobbsplain2001-08-21 03:14:40
Logged In: YES 
user_id=72656

I'm going to leave it as-is, because while it is 
not "necessary", I think it is the good citizenship thing 
to do.  I don't see the problem in making people 
(suggesting that they) register when it isn't strictly 
necessary in the code.
Log in (anonymous is fine) to add a comment.

Attachments: