Re: How to debug a compiled exe
- From: Patrick Weidener <pawei_nospom@xxxxxxx>
- Date: Mon, 22 Sep 2008 20:31:33 +0200
Ralph,
thanks for keeping me from totally rebuilding my app! I killed all DoEvents and replaced them with Sleep where necessary.
My problem was that I was doing long doevent loops in which the app could do other things that it wanted to do.
And so it do. My killer bug was the following:
On frmMain I have a usercontrol which draws a gridlike graphical interface.
You can click on a cell in the grid, and the grid will change. The grid will be built offscreen and then scrolled over the old grid surface. To slow down the scrolling I used DoEvents. While it was still scrolling, I closed the main form.
In main form's QueryUnload I said "Unload frmContainer".
frmContainer however holds a custom image list that the grid control on the main form uses to draw graphics.
What happened? frmContainer was unloaded, but the grid was still scrolling. Okay, there where no graphics drawn anymore because everything was already drawn, but at the end of the scrolling, the main form's size may be changed (caused by the previous click on the cell which caused the scrolling as well)). So now the graphics have scrolled to it's final position and the resize event is called. This causes frmMain to resize although it was queried to be unloaded.
The resize event causes the grid to be redrawn again... well, event if frmMain was unloaded, frmContainer is still loaded (again) because it was asked to use its image control to draw on the grid.
When I installed my exception handler, I could see a lot going on that was unexpected, mainly subclassing.
With doevents still all around my code and having the runtime exception handler installed, my main app window was gone, but my app still hanging in the taskmanager (because of frmContainer not being unloaded).
When I killed all doevents and replaced them with sleep, everything happened "in a fixed chain":
I clicked on a cell, the grid was redrawn and was scrolling in. While it was scrolling it, I clicked on the close button of frmMain. Unlike before, it had no immediate effect this time because my app wouldn't let me react yet (it was still busy scrolling). When scrolling was finished, the main window resized. Only after that it reacted on my close-button click, and unloaded cleanly.
LOL. I don't know if anybody really reads this but I wanted to expose my path of suffering somewhere :-)
.
- Follow-Ups:
- Re: How to debug a compiled exe
- From: Ken
- Re: How to debug a compiled exe
- References:
- How to debug a compiled exe
- From: Patrick Weidener
- Re: How to debug a compiled exe
- From: Steve Easton
- Re: How to debug a compiled exe
- From: Patrick Weidener
- Re: How to debug a compiled exe
- From: Ralph
- How to debug a compiled exe
- Prev by Date: saving contents of a picturebox/frame
- Next by Date: Re: saving contents of a picturebox/frame
- Previous by thread: Re: How to debug a compiled exe
- Next by thread: Re: How to debug a compiled exe
- Index(es):
Relevant Pages
|