How to (correctly) dispose of a d3d device using c#/dx9?

Started by
-1 comments, last by joaocorreia123 20 years, 7 months ago
Hello I have this program running using c# and dx9. (managed dx9, that is). In this program i have two modes of operation, windowed and fullscreen. In windowed mode, everything is ok, and when i close the app and run it again, no problem occur. But when i run it in fullscreen mode and exit (with no problem reported), I can no longer create a new device, because the program will hang. It doesn''t matter if it is fullscreen or windowed mode in the second run attempt. As soon as the device is created the screen mode changes to the previous run screen mode and hangs. My xp os will eventually reboot with a BSOD reporting a problem with an infinite loop and my display adapter driver. Since i create my d3d device from an existing form, and then switch it to fullscreen, it must have something to do with the dispose methods and something i am not properly terminating. I have tried to find the "right way" to do it in the dx sdk samples, but alas, the d3dapp class is, IMHO, too complex to be used as a sample and the code is, at best, obscure in some locations. I am sure it must have something to do with me not releasing (disposing) something attached to the d3d device, but i thought the c# garbage collector would do most of this dirty work automagically. If someone has any idea regarding common pitfalls in this area, please, some help would be appreciatted. Thank you for your time, Joao Correia

This topic is closed to new replies.

Advertisement