Tcl Source Code

View Ticket
Login
Ticket UUID: 648022
Title: Dde package crashing under Windows 98
Type: Bug Version: obsolete: 8.4.1
Submitter: speedboat Created on: 2002-12-03 20:36:07
Subsystem: 28. dde Package Assigned To: patthoyts
Priority: 7 High Severity: Minor
Status: Closed Last Modified: 2016-07-10 08:10:13
Resolution: Out of Date Closed By: dkf
    Closed on: 2016-07-10 08:10:13
Description:
I use tcldde12.dll to implement Drag-n-Drop (thru send 
command emulation) within our medical imaging 
software. Under Windows 98, the originating half of the 
process often (not always) crashes.

I believe I have tracked this down to a possible improper 
use of DdeCreateDataHandle(), DdeClientTransaction() 
and DdeFreeDataHandle() in the tclWinDde.c file within 
the tcl8.4.1 win directory.

While my experience with these functions is limited to 
this implementation and the online MSDN documents, it 
is my interpretation that a data handle created with 
DdeCreateDataHandle() can be used for "read only", 
once it has been successfully passed to a client using 
the DdeClientTransaction(). I believe that the use of 
DdeFreeDataHandle() violates this "read only" usage 
restriction.

My workaround to this problem is to set the 
ddeItemData variable to NULL when a successful 
DdeClientTransaction() occurs (two places). This 
prevents the DdeFreeDataHandle(ddeItemData) line in 
the cleanup section of the code from crashing.

I've marked the addional lines in the attached code with 
my initials, AGL. I would hope that someone with a 
better understanding of the Dde calls might take a look. 
Maybe I've misinterpreted the Dde documentation and 
just created a memory leak, but if so, I need a new 
solution which prevents the crashes. 

Thanks for your time.
User Comments: dkf added on 2016-07-10 08:10:13:

Win98 not supported any more; open a new bug if the problems are observable on a currently supported OS.


kennykb added on 2003-02-02 00:39:37:
Logged In: YES 
user_id=99768

The patch as submitted appears not to change the behavior where
winDde.test leaks handles, for better or for worse. Precisely the
same seven references to "TclEval" and two to "self" leak by
the end of the test.

kennykb added on 2003-02-02 00:26:11:
Logged In: YES 
user_id=99768

I'm using this bug as a place-holder for several apparent issues
with handle mismanagement in tclWinDde.c.

Observations so far with tracking data handles in DDESpy
don't indicate obvious double-frees (which is NOT to say they
aren't there!) but DO indicate that several tests leak handles,
calling into question the whole approach to handle management.

Tests in question are:

winDde-1.1 - leaks one reference to "TclEval"
winDde-2.1 - leaks one reference to "TclEval" and one to "self"
winDde-2.3 - leaks one reference to "TclEval" and one to "self"
winDde-4.1 - leaks one reference to "TclEval"
winDde-4.2 - leaks one reference to "TclEval"
winDde-4.3 - leaks one reference to "TclEval"
winDde-4.4 - leaks one reference to "TclEval"

In addition, I've observed, intemittently, a failure in winDde-4.2,
"remote interpreter did not respond." DDESpy showed some
corrupt data, but its output was lost and I haven't reproduced
the problem since.

kennykb added on 2003-01-29 07:12:16:

File Added - 40905: tclWinDde.patch

kennykb added on 2003-01-29 07:12:15:
Logged In: YES 
user_id=99768

Converted changes to a patch so that they can be applied more readily.

speedboat added on 2002-12-04 03:36:08:

File Added - 36754: tclWinDde.c

Attachments: