Solved TD-23401: Child forms using SalCreateWindowEx not destroyed

Post found bugs and possible workarounds.
Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 484
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

TD-23401: Child forms using SalCreateWindowEx not destroyed

Post by Dave Rabelink » 03 Mar 2017, 20:21

This issue has been registered as:

Ticket # 2962865 -> Forms in SalCreateWindowEx are not destroyed when parent destoys

This is the case:
When creating forms as child on a parent form using SalCreateWindowEx, normally when the parent form is closed, all childs should be destroyed automatically. So a WM_Destroy on parent will cause WM_Destroy messages fired on all child forms.

Problem:
When multiple forms are created as child AND their Z-order has been changed by using SalBringWindowToTop, forms do not destroy. Visually the parent form and childs are gone, but internally they seem to be alive.
When this is the case, the application does not close entirely. In task manager the application process is still running. The only way is to kill the process.
(when running from TD IDE, the IDE will not stop running. You have to force stop the running by using "Debug/Stop").

It seems that SalBringWindowToTop causes the issue. I tried using SetWindowPos to do the same (putting the child forms to top) but the result then is also that the application keeps running in background.

See testcase:

1) Press CreateChilds button to create 3 forms as child. They have different colors and are partially overlapping.
2) Use the button "Set top 2" to bring the second form to top. Then use button "Set top 3" to bring the third form to top.
3) Press the close button of the parent form (the caption close button)
4) See that the application is still running. The App-Exit message should display a messagebox when fired, but it is not. Use taskmanager to kill the application.
You would expect that the application stops after closing the main parent form.

Redo the test but before pressing the close button, use the "Destroy" button. This will manually do destroy of the child forms.
If you then close the parent form, it is closed correctly.

Now see that even manually destroy the forms on SAM_Destroy does not help. SalDestroyWindow will return FALSE.

The only real workaround is to manually destroy the forms using WinApi DestroyWindow method. This will destroy the forms and let the parent form destroy too.

The sample is TD61 format. See that all TD versions work ok. This has started with TD 7.0.
ChildsBringWindowToTop_TD61.zip
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 484
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD-23401: Child forms using SalCreateWindowEx not destroyed

Post by Dave Rabelink » 03 Mar 2017, 20:23

[From Gupta Support]

Defects already logged: TD-23396 and TD-23401.

This will be fixed with TD7.0 Update 2.

Best regards,
Mike Vandine
Gupta Technologies
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 484
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD-23401: Child forms using SalCreateWindowEx not destroyed

Post by Dave Rabelink » 12 Jun 2017, 07:24

This defect has been fixed in TD 7.0.2.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Return to “Bug Reports”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests