View Full Version : Win 2k Minimize Crash
04-30-2002, 11:21 PM
Here is a problem that has perplexed me. In my OpenGL applications I have a resize member function that calls glViewport. The resize is called when the window is first created without any problem. However, when I minimize the window, the application crashes at the glViewport. This only happens when I minimize before I do any other type of resize. If I resize the window first, minimize works fine. Also, the application does not crash while I'm debuging in Visual C. Anyone have any suggestions?
05-01-2002, 01:20 AM
Is it crashing in the glViewport() function ?
Are you using MFC ?, sometimes you get crashes if you don't check for zero values in cx,cy.
Is it possible that this might be the problem ?
I always add code in the resize handler like:
if( cx > 0 && cy > 0)
bla bla bla
05-01-2002, 01:20 AM
Sounds like you do not initialize some of your variables properly.
05-01-2002, 02:40 AM
Iím not using MFC. Minimizing the window does pass zeros to my Resize function, but they are handled. I also check for null pointers but that doesnít seem to be the problem either. The minimize works if I resize the window first. The program does not crash the first time Resize is called at creation. If the second call is for a minimize then it crashes. If the second call is not a minimize then the program run perfectly after that including minimize.
I canít replicate the error in the debugger (which is a mystery in itself), but when I comment out the glViewport line the program works so I believe that is where the crash occurs.
I get the feeling that this is something very obscure. Someone could probably convince me that gamma rays are the problem if they made a good argument.
Why would you call a glViewport when the window minimizes? Usually minimized applications suspend rendering to the minimized window altogether until the window is restored.
YMMV of course.
05-01-2002, 04:09 AM
My main message loop catches all WM_SIZE messages, which includes minimize.
Iíve just changes my case statement to check what type of resize it is and to only use my Resize function if it is a manual resize. This stops the program from crashing when minimizing after initialization.
Thatís solves my problem, but doesnít satisfy my curiosity. If anyone knows why minimize causes problems before a manual resize of the window but not after; or why the problem doesnít occur in debug, Iíd love to know.
Thanks for your help.
05-01-2002, 04:28 AM
but can't you specifically catch a minimize message? in your message handler, when the msg is WM_SIZE, check wParam for SIZE_MINIMIZED and do your handling there.
[EDIT]nevermind...you already fixed it
[This message has been edited by coredump (edited 05-01-2002).]
05-02-2002, 01:15 AM
What about showing us some code ?
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.