Reputation: 398
I have a moderately complex program that uses several third party components that I have been maintaining for >20 years over many iterations of Borland/Codegear/Embarcadero IDE's. The latest iteration (using Delphi 2010) has a problem that appears only on some user's machines where it stops responding on shut down. If the user right clicks the Task Bar icon and selects "Close" again, the program will shut down.
I have tried to reproduce the problem at my location without success. I have implemented various logging schemes and can see that execution stalls after the FormCloseQuery procedure but before the FormDestroy event.
There are multiple forms and several threads executing when the user initiates shut down.
I created a little debug program that registers a windows message and displays information from the app in question. This is what I see:
Debug Message ID = 49681
7/28/2015 2:34:26 PM - MyApp initialized
7/28/2015 2:34:42 PM - Port opened COM3
7/28/2015 2:34:44 PM - Port opened COM5
7/28/2015 3:14:51 PM - Port closed COM3
7/28/2015 3:14:51 PM - Port closed COM5
7/28/2015 3:14:51 PM - MyApp closing (last line in MainForm.OnCloseQuery)
7/28/2015 3:14:51 PM - Configuration window destroy **stalls here**
7/28/2015 3:15:25 PM - Run Table destroy
7/28/2015 3:15:25 PM - Alert window destroy
7/28/2015 3:15:25 PM - Sample Table destroy
7/28/2015 3:15:25 PM - Debug window destroy
7/28/2015 3:15:25 PM - Main window destroy
7/28/2015 3:15:26 PM - Main window finalize
The Configuration window creates and owns several child forms. In the Configuration window OnDestroy code these are freed, but there is a call to Application.ProcessMessages. (Back in the early 2000's there was a problem where sometimes a form would be sent a message while it was being freed) Could this be the problem?
Upvotes: 1
Views: 544
Reputation: 398
There was a call to Application.ProcessMessages in the FormDestroy event handler of my configuration window. After I took that out the customer has not seen the problem.
Upvotes: 0