Sign in to follow this  

SDL_CreateCursor Access Violation?

Recommended Posts

For some reason this code causes an access violation (segmentation fault) when it runs. It occurs on the line with the SDL_CreateCursor call in it. I'm not sure exactly why that is, I've tried quite a few things and can't figure what memory is getting stomped on. Anybody with any ideas? The rest of my project works fine without the pointer code in it. Cheers, Bob
void NIGHT_system::load_cursors()
//your standard pointy cursor

    static unsigned char pointer_bit_map[]={			
			0x03,  0x00, 0x05,  0x00, 0x09,  0x00, 0x11,  0x00,
			0x21,  0x00, 0x41,  0x00, 0x81,  0x00, 0x01,  0x01,
			0x01,  0x02, 0xc1,  0x03, 0x49,  0x00, 0x8d,  0x00,
			0x8b,  0x00, 0x10,  0x01, 0x90,  0x01, 0x60,  0x00
    static unsigned char pointer_bit_mask[]={	
            0x03,  0x00,  0x07,  0x00,  0x0f,  0x00,  0x1f,  0x00,
			0x3f,  0x00,  0x7f,  0x00,  0xff,  0x00,  0xff,  0x01,
			0xff,  0x03,  0xff,  0x03,  0x7f,  0x00,  0xff,  0x00,
			0xfb,  0x00,  0xf0,  0x01,  0xf0,  0x01,  0x60,  0x00 
    SDL_Cursor* temp_cursor;
    temp_cursor=SDL_CreateCursor(pointer_bit_map, pointer_bit_mask, 16,16,6,7);

..etc through the rest of the cursors. 

Share this post

Link to post
Share on other sites
I am stupid.

I had the cursor initiation in my application class constructor for some reason. I have an initialization function as well that initializes everything else. Once it got moved back to the right place, everything was happy. I should have caught that sooner.

Thanks for your help.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this