We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 342

Summary: Crash on mode switch in SDL_SetCursor(NULL) with invisible software mouse cursor.
Product: SDL Reporter: bartoldeman
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 1.2.11   
Hardware: x86   
OS: Linux   
Attachments: Small patch to test video driver cursor function are not NULL

Description bartoldeman 2006-10-08 16:09:26 UTC
The following simple program

#include <SDL/SDL.h>

int main(void)
{
  SDL_Init(SDL_INIT_VIDEO);
  SDL_ShowCursor(SDL_DISABLE);
  SDL_SetVideoMode(640,480,8,0);
}

crashes:

#0  0x00000000 in ?? ()
#1  0x00d703bb in SDL_SetCursor () from /usr/lib/libSDL-1.2.so.0
#2  0x00d75d2c in SDL_SetVideoMode () from /usr/lib/libSDL-1.2.so.0
#3  0x080484f1 in main () at sdl.c:7

for all video output drivers with a software mouse cursor (e.g. aalib, fbdev).

The problem is in src/video/SDL_cursor.c, line 222.
video->ShowWMCursor(this, NULL);

I'm not sure what the best fix would be but checking
SDL_cursor->wm_cursor
seems logical.

There are various workarounds (without changing SDL): temporarily switching showing the cursor during a mode switch for instance.

Bart
Comment 1 Patrice Mandin 2006-11-16 14:11:12 UTC
Created attachment 183 [details]
Small patch to test video driver cursor function are not NULL

There is still a fixme remaining as I don't know how I should fix it correctly
Comment 2 Patrice Mandin 2006-11-16 14:12:29 UTC
Comment on attachment 183 [details]
Small patch to test video driver cursor function are not NULL

It happens when the video driver does not support mouse cursor (and related function pointers are NULL).
Comment 3 Patrice Mandin 2006-11-19 09:17:56 UTC
Fixed in SDL-1.2 svn now.