Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-20
01:48 • Ticket [218361ffff] Tcl_GetEncoding modifing a shared object... status still... artifact: ddc04ae6da user: dgp
2000-10-26
08:20 • Closed ticket [218361ffff]. artifact: f86580cd1d user: welch
00:56 • New ticket [218361ffff]. artifact: 2e0cb49dce user: nobody

Tcl_GetEncoding modifing a shared object...

Closed / Fixed218361ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:56:42
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
welch Closed ticket [218361ffff]. [History diff]2000-10-26 08:20:08
dgp Ticket [218361ffff]: 3 changes [History diff]2001-04-20 01:48:11
Log in (anonymous is fine) to add a comment.