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


Arrrgh!!!! Pointers-Crash-Reboot!

Recommended Posts

I''ve been trying to solve this problem all night and I can''t seem to get around it. I''ve made a class called CTextField, which is baically a text field which would be used like a windows edit control. Everything in it works fine, except for one thing. What I have done is I have another class, called CGrfxFont, which is a font class I''ve made. Now, to display the text field on the screen, I draw the field itself and then the text over. To draw text, I use a CGrfxFont object and call the method "PrintText", which of course prints text to a coordinate on the screen. The thing is, that one of the member variables in a pointer to a CGrfxFont object so I can simply use "SomeFontObject->PrintText(params go here)" Anyway, the problem is that when I run the program, I get a bluescreen error and I am forced to restart my computer. This error ocurrs in the render method in my CTextfield class, which draws some rectangles to the screen and then uses the pointer to the font class to draw some text to the screen. I''m not sure what I''ve done wrong, could someone perhaps enlighten me on my mistake? I have remembered to set the pointer to the font object to 0 in the destructor since I''ve heard that VisualC++ debug often tries to release memory assigned to a pointer even if you didn''t release it yourself.

Share this post

Link to post
Share on other sites