Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2e0cb49dceb4ac15690758bf8db1492617b7996e
Ticket: 218361ffffffffffffffffffffffffffffffffff
Tcl_GetEncoding modifing a shared object...
User & Date: nobody on 2000-10-26 00:56:42
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 4180 Bug
    Version: 8.3
    SubmitDate: '2000-02-15'
    LastModified: '2000-04-03'
    Severity: CRIT
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    OS: BSD
    FixedDate: '2000-10-25'
    ClosedDate: '2000-04-03'
    
    
    Name:
    Petasis George
    
    ReproducibleScript:
    I have written this little function for converting between external->UTF:(Strdup duplicates a UTF-8 string...)
    
    char *ExternalToUtf(char *encoding, char *str) {
      Tcl_DString Text;
      Tcl_Encoding enc;
      char *result;
    
      //My_Interp is a global that contains a pointer to the only interp my app uses...
      //Tcl_ResetResult(My_Interp); //If you add this the abort is gone...
      enc = Tcl_GetEncoding(CDM_Interp, encoding);
      if (encoding == NULL) return NULL; // Tcl_GetEncoding has left an error...
      Tcl_DStringInit(&Text);
      result = Strdup(Tcl_ExternalToUtfDString(enc, str, -1, &Text));
      Tcl_DStringFree(&Text);
      Tcl_FreeEncoding(enc);
      return result;
    }
    
    If you set the system encoding (example) to cp1253 and you keep
    calling this function to convert strings to iso8859-7
    (like: ExternalToUtf("iso8859-7", "some-greek-string in iso8859-7 enc");)
    Then you will get an abort after a few iterations...
    
    ObservedBehavior:
    When calling Tcl_GetEncoding and Tcl_FreeEncoding many times (i.e. in a loop) and you
    always request the same encoding( but a different one than the system encoding), then
    wish crashes under windows with a message about Tcl_SetObjLength modifing a shared
    object. I think that one of these functions tries to modify the given interpreter without
    checking if its object is shared or not. If I put Tcl_ResetResult just before calling these
    functions, all work ok. This problem is much easier to reproduce it under windows than 
    unix...
    
    
    
    This look suspiciously like an app that doesn't have the
    Tcl_FindExecutable call that is necessary for 8.1+ apps
    that use encodings.  Is this the case?  We need to see the
    startup code to know more. 
    -- 04/03/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "Tcl_GetEncoding modifing a shared object..."
  11. type changed to: "Bug"