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 - Application crash on SDL_Init under OSX 10.6
Summary: Application crash on SDL_Init under OSX 10.6
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: x86_64 Mac OS X 10.6
: P2 critical
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-21 18:01 UTC by Nicholas Phillips
Modified: 2009-11-22 12:51 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.