Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

karmalaa

OpenGL OpenGL Shutdown Problem

This topic is 6311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, upon the close up of an OpenGL sample application of mine, I get a "Invalid Address specified to RtlFreeHeap(...)" error. The stack context in which it happens to some "finalization" code within the G400ICD.dll called from the "exit()" procedure. I really can''t guess why this happens. OpenGL finalization ("wglMakeCurrent(NULL, NULL)", "ReleaseDC(hWhd, hDC)", and "wglDeleteContext(hRC)") and window destruction ("DestroyWindow(hWnd)" and "UnregisterClass()") do their job correcly. However, the problem persist. Is there something I''m missing? Hope someone can spot some Light on this problem of mine... [home page] [e-mail] --- "Lifting shadows off a dream once broken She can turn a drop of water into an ocean"

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Well, My shutdown code is something like:

hDC = GetDC(hWnd);
wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC);
ReleaseDC(hWnd, hDC);

I''m not sure what effect (in your case) wglMakeCurrent(NULL, NULL); would have. Do other OpenGL programs function okay on your hardware?

Share this post


Link to post
Share on other sites
Dear Anonimous Poster,
according to the official documentation, passing NULL as second argument to "wglMakeCurrent()" make the first one to be ignored. So, using both "wglMakeCurrent(hDC, NULL)" and "wglMakeCurrent(NULL, NULL)" should be equivalent.

I''ve tried, though, and it makes no difference to pass a valid DC pointer as the first argument. The application still "hung up" upon exiting.

BTW, other people''s (such as NeHe) sample code compiles and works perfectly on my computer.





[home page] [e-mail]

---
"Lifting shadows off a dream once broken
She can turn a drop of water into an ocean"

Share this post


Link to post
Share on other sites
Well what is different about your code than NeHes code?

Are you using any Extensions any special features?

I would try disabling all of my drawing code and as much of my initialization code as I can and try to pinpoint where the error is originating from. Step through the shutdown and examine the return values.

Basically what that error is saying is that it is trying to deallocate a memory heap that either never existed or (more likely) there is a reference to memory that has already been deallocated which it is trying to deallocate again as part of standard cleanup procedures. Since it is being initiated by your video card driver DLL (Im assuming you have a G400?) it might be a context issue.

Try making sure you set device context and rendering context variables to NULL after deleting and releasing them.

Seeya
Krippy

Share this post


Link to post
Share on other sites
quote:
Original post by Krippy2k

Well what is different about your code than NeHes code?




I''ve changed the order in which the window-class and fullscreen switching is done. In general I''ve cleaned up the code a lot. No substantial modification, however.

quote:
Original post by Krippy2k

Are you using any Extensions any special features?




No. Not at all.

quote:
Original post by Krippy2k

I would try disabling all of my drawing code and as much of my initialization code as I can and try to pinpoint where the error is originating from. Step through the shutdown and examine the return values.




I''ve already checked up on it. Initialization and finalization works perfectly. It is surely a RENDERING CONTEXT issue, since not creating it (and of course not using and not deleting it) make the problem to vanish.

quote:
Original post by Krippy2k

Try making sure you set device context and rendering context variables to NULL after deleting and releasing them.




Oh, my God... I really do not dispose twice the same resources and I *HOPE* the videocard driver DLL does not mess up with them. Just joking...

As a general practice, I always reset to NULL the pointers after deleting them.



---
[home page] [e-mail]

Share this post


Link to post
Share on other sites
Are you using WinNT/2k and/or multiple threads?

And have you tried just for giggles commenting out the wglDeleteContext to see what happens?



Share this post


Link to post
Share on other sites
quote:
Original post by Krippy2k

Are you using WinNT/2k and/or multiple threads?




Yep, I''m developing both under Windows 2000 Professional (SP1) (using Visual .NET - Beta 1) and under Windows NT4 (SP6) (using Visual Studio 6 - SP5). Strangely enough, it works on the first one but not on the second.

I''m currently NOT using any additional thread.

quote:
Original post by Krippy2k

And have you tried just for giggles commenting out the wglDeleteContext to see what happens?




Yep. Nothing seems to change. The error still remains...



---
[home page] [e-mail]

Share this post


Link to post
Share on other sites
I''m getting the same error.

HEAP[lesson2.exe]: Invalid Address specified to RtlFreeHeap( 130000, 1b80e8 )

That''s what I get when NEHE''s lesson 2 program exits. This ONLY happens in the Visual C++ IDE though, outside of it the program runs fine. I''m using VC++ 6, Windows NT 5 (2000). I''ve been having some problems with VC++ lately though, so I''m going to reinstall it and see if that helps.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!