Menu

#2114 Dde package crashing under Windows 98

obsolete: 8.4.1
open
7
2003-03-21
2002-12-03
Al Larson
No

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.

Discussion

  • Al Larson

    Al Larson - 2002-12-03

    tclWinDde.c with my changes that seem to be working.

     
  • Kevin B KENNY

    Kevin B KENNY - 2003-01-29

    Logged In: YES
    user_id=99768

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

     
  • Kevin B KENNY

    Kevin B KENNY - 2003-01-29

    Original poster's changes in patch form

     
  • Kevin B KENNY

    Kevin B KENNY - 2003-02-01

    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.

     
  • Kevin B KENNY

    Kevin B KENNY - 2003-02-01
    • priority: 5 --> 7
     
  • Kevin B KENNY

    Kevin B KENNY - 2003-02-01

    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.

     
  • Kevin B KENNY

    Kevin B KENNY - 2003-03-21
    • assigned_to: kennykb --> patthoyts