Bug in DDE 1.0 package found
Closed / Fixed218786ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:05:20
OriginalBugID: 2124 Bug Version: 8.1 SubmitDate: '1999-05-24' LastModified: '1999-07-01' Severity: MED Status: Released Submitter: pat ChangedBy: foster OS: Windows 95 OSVersion: NA Machine: NA FixedDate: '1999-05-28' FixedInVersion: 8.2b1 ClosedDate: '2000-10-25' Name: Peter Hardie email: [email protected] Support: None Severity: 3 OperatingSystem: Windows 95 Extensions: DDE 1.0 CustomShell: Other than my fixes to DDE 1.0 the code is the distribution version. Synopsis: Bug in DDE 1.0 package found ReproducibleScript: I reported the bug previously in comp.lang.tcl as a followup to another bug report of bizarre behaviour in the DDE V1.0 package. In the example I posted, my script was attempting to talk to Mirc, but the first such message always caused netscape to be executed instead. However, now that I know the cause of the problem it is clear that my example script will not necessarily produce the same behaviour on another system because the bug depends upon some things in the machine that are external to TCL/Tk. I have included a short code segment showing the fix (I do not have access to diff - sorry). DesiredBehavior: The problem is that Tcl_DdeObjCmd in TclWinDde.c is using the ddeInstance variable before it has been initialized by calling the Initialize() function. See the code below. My fix may not be the most effective way to solve the problem but it definitely does work. Patch: In the Tcl_DdeObjCmd function in TclWinDde.c add the two calls to Initialize() as shown below: if (length == 0) { serviceName = NULL; } else if (index != DDE_SERVERNAME) { // ******************* // This call to Initialize() is essential so that ddeInstance is defined the // first time through this routine. Initialize(); ddeService = DdeCreateStringHandle(ddeInstance,serviceName,CP_WINANSI); } if ((index != DDE_SERVERNAME) &&(index != DDE_EVAL)) { topicName = Tcl_GetStringFromObj(objv[firstArg + 1], &length); if (length == 0) { topicName = NULL; } else { // *************************** // Must also call Initialize here too. Initialize(); ddeTopic = DdeCreateStringHandle(ddeInstance,topicName, CP_WINANSI); } } Comments: There are several other bugs in the code, but this is by far the most serious. I have also added a "dde poke" command to my version of dde 1.0 and once I have tidied it up and squashed the other bugs, I will submit it (using diff once I find it). A call to Initialize has been added at the beginning of the block. 05/28/1999 15:53 - stanton -
welch Closed ticket [218786ffff].
[History diff]2000-10-26 08:29:14
dgp Ticket [218786ffff]: 3 changes
[History diff]2001-04-17 10:44:38
Log in (anonymous is fine) to add a comment.