App isn't closing

Started by
11 comments, last by Brian Jones 20 years, 12 months ago
This is not a Windows bug. If it's happening only on your application, chances are the problem is your application. I could tell you a few story where I was 100% it was a system bug while the problem was in fact me, including one where I went to bed and my app was working, and the next morning, it was no longer working WITHOUT ANY CHANGE, I just came in and clicked the run button and... nothing... and guess what? It was my fault. I won't go into details.

---

Are you creating any other thread in your app? Because as long as you have another thread running, your app won't exit. Usually, when that happens the window is destroyed and your app is invisible, but you still have to go in the task manager to close it.

However, looking at the way you (do NOT) destroy your window, if that very same problem happenend in this application, the window would stay here and nothing would happen because you would never reach the point where Windows cleans after you. Also, I noticed that when calling ReleaseAll you also call WM_CLOSE, so tell me, is that ReleaseAll function called before of after closing the window. Because as it seems now, it's called when exiting run loop and you call WM_CLOSE again.

Switching from Debug mode to Release mode could have caused the emmergence of this bug because in release mode, with optimization, you obtain some real strange behavior when accessing the same variables without locking.

That said, if you have multithreads, try switching to debug mode, if it fixes the problem, it's probably because your app is not thread safe. Fix it. Also, you should really look into destroying your window the right way. You may had problem previously, probably because you called ReleaseAll after actually destroying the window.


Good luck

______________________________
Oooh, you found the horadric cube!

[edited by - Coincoin on April 19, 2003 10:05:33 AM]
Editor42 ...builds worlds
Advertisement
replace this

  case WM_DESTROY:     {          PostQuitMessage(0);          return (0);     }break;  


with this

  case WM_DESTROY:     {          DefWindowProc (hWnd, uMsg, wParam, lParam);                    // shut down everything...          ExitProcess (0);                    return 0;  // never reach here :-)     }  
Thank you all for your input. I reformmated last night, just made a sample OGL app, and everything works fine. Coincoin, there are no other threads in my apps. Also, I was calling ReleaseAll() after closing the window (after exiting the event loop). I will restructure my windows procedure. Didn''t realize it was the improper way to exit an app before this. I never had any problems with it. Again, thank you all for your input

I don''t have a signature
I don't have a signature

This topic is closed to new replies.

Advertisement