pointer to pointer assignment

hi everyone

i have a problem with my texture class

1
2
3
4
5
6
private:
SDL_Texture * mTex;
...
public:
void SetTexture(SDL_Texture * tex);
...


1
2
3
4
void texture::SetTexture(SDL_Texture * tex)
{
    mTex = tex;
}


so as you see when someone uses this function. it will automatically assign a texture loaded by user to class private mTex

what i cant understand is when i run the program to test it i receive SIGSEGV error and debugger says mTex = tex; line is the problem.

I cant see the problem. why it is problematic and gives sigsegv error.
Last edited on
Probably the instance of your class being referred to is invalid, so when you use the SetTexture function on the invalid instance, it crashes.
L B thx for your help firstly.

i found out i was including texture class at font and font at texture. it was the thing causes error although i dont know why it causes yet.

anyways thx again.
Topic archived. No new replies allowed.