Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualHyunkel

Posted 28 March 2012 - 03:55 PM

Sounds like you're calling delete() on an invalid pointer.

You should initialize all your pointers to NULL and do something along the lines of:

if(Pointer)
{
delete(Pointer);
     Pointer = NULL;
}

to avoid this issue.

You can also define safe delete / release functions like this:
#define SAFE_RELEASE( x ) {if(x){(x)->Release();(x)=NULL;}}
#define SAFE_DELETE( x ) {if(x){delete (x);(x)=NULL;}}
#define SAFE_DELETE_ARRAY( x ) {if(x){delete[] (x);(x)=NULL;}}

but you will have to initialize all pointers to NULL first.

#2Hyunkel

Posted 28 March 2012 - 03:54 PM

Sounds like you're calling delete() on an invalid pointer.

You should initialize all your pointers to NULL and do something along the lines of:
(Assuming Device being a pointer to your d3d device)

if(Device)
{
delete(Device);
     Device = NULL;
}

to avoid this issue.

You can also define safe delete / release functions like this:
#define SAFE_RELEASE( x ) {if(x){(x)->Release();(x)=NULL;}}
#define SAFE_DELETE( x ) {if(x){delete (x);(x)=NULL;}}
#define SAFE_DELETE_ARRAY( x ) {if(x){delete[] (x);(x)=NULL;}}

but you will have to initialize all pointers to NULL first.

#1Hyunkel

Posted 28 March 2012 - 03:53 PM

Sounds like you're calling delete() on an invalid pointer.

You should initialize all your pointers to NULL and do something along the lines of:

if(Pointer)
{
     delete(Pointer);
     Pointer = NULL;
}

to avoid this issue.

You can also define safe delete / release functions like this:
#define SAFE_RELEASE( x ) {if(x){(x)->Release();(x)=NULL;}}
#define SAFE_DELETE( x ) {if(x){delete (x);(x)=NULL;}}
#define SAFE_DELETE_ARRAY( x ) {if(x){delete[] (x);(x)=NULL;}}

but you will have to initialize all pointers to NULL first.

PARTNERS