DupByteArrayInternalRep does not set object type of new object 
Author Message
 DupByteArrayInternalRep does not set object type of new object

Tcl 8.1 Bug:  Generated by Scriptics' bug entry form at
        http://www.*-*-*.com/
Responses to this post are encouraged.
------

Submitted by:  Robert Hare
OperatingSystem:  Other
OperatingSystemVersion:  BSD/OS 4.0.1
Synopsis:  DupByteArrayInternalRep does not set object type of new object

ReproducibleScript:
    The DupByteArrayInternalRep routine in tclBinary.c does not set the type
    in the
    copyPtr object to &tclByteArrayType.

ObservedBehavior:
    While creating a new extension, I recevied a segmentation fault when
    calling
    Tcl_GetByteArrayFromObj on an object that had been duplicated.

Patch:
*** tclBinary.c.orig    Tue May 11 20:21:22 1999
--- tclBinary.c Tue May 11 23:21:52 1999
***************
*** 457,462 ****
--- 457,463 ----
      memcpy((VOID *) copyArrayPtr->bytes, (VOID *) srcArrayPtr->bytes,
            (size_t) length);
      SET_BYTEARRAY(copyPtr, copyArrayPtr);
+     copyPtr->typePtr = &tclByteArrayType;
  }
  ^L
  /*

PatchFiles:
    tclBinary.c

Comments:
    I have been unable to come up with a non-extended Tcl script that will  
    demonstrate this problem outside of my extension.  However, looking at
    DupListInternalRep in the List object reveals that the dupIntRepProc
    should set the object type in the copy.  I suspect there is a way to
    generate the problem
    without an extension, but I haven't found it yet.



Sun, 28 Oct 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. type(type) is an object, not an instance

2. new object orient variant (has this been done?)

3. How to set object class type for OLE automation

4. Why object.__getattribute__ and not object.__getattr__ ?

5. ANNOUNCEMENT: Object-Oriented Systems - new object-oriented journal

6. object must not be deeper than the access type

7. ANNOUNCEMENT: Object-Oriented Systems - new object-oriented journal

8. Adding a new object type

9. Extending with new Object types

10. ANNOUNCE: Dictionary 1.0: a new Tcl object type

11. New tcl object type (help wanted)...

12. long: Sample of how to implement a new object type in Tcl8.0

 

 
Powered by phpBB® Forum Software