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 890

Summary: Application crash on SDL_Init under OSX 10.6
Product: SDL Reporter: Nicholas Phillips <eudoxus>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Mac OS X 10.6   

Description Nicholas Phillips 2009-11-21 18:01:11 UTC
Using OSX 10.6 on a new MacBook Pro, I just updated SDL 1.3 to the latest SVN revision (5303), and my applications now crash when calling SDL_Init.

My code worked fine in the previous SVN version of SDL 1.3.

Crash info:

Upon calling 

SDL_Init(SDL_INIT_VIDEO);

application crashes with:

"
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x00000001000d7119 in Cocoa_InitMouse (_this=<value temporarily unavailable, due to optimizations>) at ./src/video/cocoa/SDL_cocoamouse.m:35
35	    data->mouse = SDL_AddMouse(&mouse, "Mouse", 0, 0, 1);
"

Let me know if I can provide any more info that would help. 

I will see if I can figure anything out on my end.
Comment 1 Nicholas Phillips 2009-11-22 12:27:30 UTC
Alright, this seems like a simple error. I found that at SDL_cocoamouse.m:35, data has the value 0x0. So it seems that _this->driverdata is never set. Setting data to the the appropriate memory address as allocated in Cocoa_CreateDevice(...) allows the program to run normally:

Breakpoint 1, Cocoa_CreateDevice (devindex=<value temporarily unavailable, due to optimizations>) at src/video/cocoa/SDL_cocoavideo.m:67
67	    device->driverdata = data;

(gdb) step
70	    Gestalt(gestaltSystemVersion, &data->osversion);

(gdb) print device->driverdata
$3 = (void *) 0x102013c20

(gdb) break SDL_cocoamouse.m:35
Breakpoint 2 at 0x1000d7100: file src/video/cocoa/SDL_cocoamouse.m, line 35.

(gdb) continue
Continuing.

Breakpoint 2, Cocoa_InitMouse (_this=<value temporarily unavailable, due to optimizations>) at src/video/cocoa/SDL_cocoamouse.m:35
35	    data->mouse = SDL_AddMouse(&mouse, "Mouse", 0, 0, 1);

(gdb) set data=0x102013c20

(gdb) continue


... At this point my application runs normally.
Comment 2 Nicholas Phillips 2009-11-22 12:51:27 UTC
This issue has been addressed in SVN revision 5308.

Marking bug as fixed.