Closed PeterPanino closed 2 years ago
Would closing its main window call free on some object (database connection)? What would be the minimal working sample?
@PeterPanino is there a api call that you would suggest?
Well, there's the CloseWindow
API call in Winapi.Windows.
AFAIK, CloseWindow
indeed calls Free on all objects owned by the main window and thus by the process.
BTW, thanks for Deputy. I have long wished for such an expert.
To get the main window handle, there are different solutions:
I will try to work up something using EnumWindows, QuickLib from Exilon has at least a starting point in QuickLib.Process, but on first try that did not work.
I modified my VCL demo output a debug string on datamodule destroy and form destroy. That should confirm that the destructors get called.
Do you have a splash screen that stays open or just a child form(s)?
@PeterPanino I believe the logic for identifying the main form is complete, can you give it a try against your application and verify that it closes correctly? There is a video and tool here: https://github.com/SwiftExpat/Deputy/releases/tag/2.4.5
Just run ProcTreeVCL and edit the text box to your app name. The code essentially finds the window and publishes wm_close but you can review it here: https://github.com/SwiftExpat/Deputy/tree/main/DevTools/ProcTreeVCL
On the terminate logic, how long should Deputy wait for the app to close? I am thinking wait a few seconds, configurable, then if the app does not close, terminate it. Or message with a notification and stop the build in the IDE.
If the app is running with report memory on shutdown, Deputy should watch for that window. Options could be:
Most of the close and poll for mem leak is done. The logic still needs a global timeout to ensure the IDE returns at some point.
2.5.1 addresses close functionality. Go to Tools, SE Deputy, Kill process settings.
You can choose to terminate or close, and then choose your actions for the memory leak window, close and optionally copy the memory leak
Instead of killing the process, there should be an option to CLOSE ITS MAIN WINDOW.