Archived

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

"m_pDevice = pDevice" ... Causing access violation??

This topic is 5310 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

I have made a few posts already today, and I have another problem. I got the CD3DFont class working, but it won''t draw text. I made a function in my game''s font class like this:
  
void RR_Font::SetDevice(LPDIRECT3DDEVICE8 pDevice) 
{
    if (pDevice != NULL)      // Valid device

        m_pDevice = pDevice;      // Copy LPDIRECT3DDEVICE8 object

}
  
But when I run in debug mode, it says there''s an access violation on the line "m_pDevice = pDevice". The ''pDevice'' object is valid. What''s wrong here?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Generally this would happen if the "this" pointer is invalid; in other words, the object has not been properly contructed before your method is called.

Share this post


Link to post
Share on other sites