Well I'm working on a small project, a Blackjack game in C++. I'm getting an Access Violation error when I try to delete a pointer to an object.
Sprite* message;
void showMessage ()
{
message->draw();
glutSwapBuffers();
Sleep(2000);
delete message;
}
showMessage() is only called from the function below.
void drawAll()
{
showHands();
showButtons();
if (message != NULL)
{
showMessage();
}
glutSwapBuffers();
}
I have a feeling it's really stupid problem that I'll probably kick myself over when I found out what it is, but I can't, for the life of me, think of what it is.
I think that's all the necessary code
Any help would be appreciated.
It might be worth mentioning that drawAll() is called in the glutDisplayFunc... But I'm not sure if this would make any difference.
Thanks