DEFINE CLASS xForm as Form DataSession = 2 oComm = .null. PROCEDURE init This.oComm = createobject( "mscommlib.MSComm" ) EVENTHANDLER( this.oComm, NEWOBJECT("commevents", 'pump.prg' ) ) ENDPROC ENDDEFINE DEFINE CLASS commevents AS custom IMPLEMENTS DMSCommEvents IN "mscommlib.MSComm" procedure Destroy ? 'destroy fired' ENDPROC PROCEDURE DMSCommEvents_OnComm() AS VOID; HELPSTRING "Occurs whenever the value of the CommEvent property changes." ENDPROC ENDDEFINEFrom the command window, I did the following:
o = NEWOBJECT('xform', 'pump.prg') o.Show()I then click the close button the form, the Destroy does fire, the form is released, and I have no dangling private data session. Look for code in your form that may prevent the destroy in the CommEvents class from firing.