The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL 1.2.14 on Mac OS X 10.7
kbaker


Joined: 24 May 2011
Posts: 7
Hello everyone,

A user of our software's Slide Show module is experiencing crashes when running on Mac OS X 10.7. A crash report was filed and received by us. We use libSDL 1.2.14 to take over the screen via SDL_SetVideoMode() at the start of the Slide Show. Here is a partial stack trace from the crash reporter:

Code:

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000

VM Regions Near 0:
--> __PAGEZERO             0000000000000000-0000000000001000 [    4K] ---/--- SM=NUL  /Applications/Photo Mechanic.app/Contents/MacOS/Photo Mechanic
   __TEXT                 0000000000001000-00000000006c6000 [ 6932K] r-x/rwx SM=COW  /Applications/Photo Mechanic.app/Contents/MacOS/Photo Mechanic

Application Specific Information:
objc[544]: garbage collection is OFF
Performing @selector(OnBnClickedStart:) from sender NSButton 0x9d09210
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib           0x941d19c6 __pthread_kill + 10
1   libsystem_c.dylib                0x906d4f98 pthread_kill + 106
2   libsystem_c.dylib                0x906c5bfd abort + 167
3   libruby.1.8.4.dylib              0x00a68b80 rb_bug + 243 (error.c:205)
4   libruby.1.8.4.dylib              0x00ad00be sigbus + 26 (signal.c:446)
5   libsystem_c.dylib                0x9072a59b _sigtramp + 43
6   ???                              0xffffffff 0 + 4294967295
7   SDL                              0x00c4e515 SDL_SetVideoMode + 1077
8   com.camerabits.PhotoMechanic     0x0002fe0e Slideshow::init() + 302
9   com.camerabits.PhotoMechanic     0x002aaef1 SlideDialog::OnBnClickedStart() + 97
10  com.apple.CoreFoundation         0x9bae3251 -[NSObject performSelector:withObject:] + 65
11  com.apple.AppKit                 0x9439ce4a -[NSApplication sendAction:to:from:] + 232
12  com.apple.AppKit                 0x9439cd28 -[NSControl sendAction:to:] + 102
13  com.apple.AppKit                 0x9439cc2b -[NSCell _sendActionFrom:] + 160
14  com.apple.AppKit                 0x9439bfe6 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2295
15  com.apple.AppKit                 0x9441e839 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 501
16  com.apple.AppKit                 0x9439aa27 -[NSControl mouseDown:] + 943
17  com.apple.AppKit                 0x943638d2 -[NSWindow sendEvent:] + 7514
18  com.apple.AppKit                 0x942fbcf1 -[NSApplication sendEvent:] + 4235
19  com.camerabits.PhotoMechanic     0x00090a97 -[CPMApp sendEvent:] + 71
20  com.apple.AppKit                 0x94565239 -[NSApplication _modalSession:sendEvent:] + 550
21  com.apple.AppKit                 0x94564e03 -[NSApplication _realDoModalLoop:peek:] + 638
22  com.apple.AppKit                 0x94560413 -[NSApplication _doModalLoop:peek:] + 69
23  com.apple.AppKit                 0x94564adf -[NSApplication runModalForWindow:] + 258
24  com.camerabits.PhotoMechanic     0x000cd723 CDialog::RunModalLoop(unsigned long) + 259
25  com.camerabits.PhotoMechanic     0x000cdaa2 CDialog::DoModal() + 274
26  com.camerabits.PhotoMechanic     0x000aabe4 +[SlideDialogController runSlideshowWithContactSheet:andDocument:selectedCells:] + 180
27  com.camerabits.PhotoMechanic     0x0004d75b -[CContactSheetView runSlideshow:] + 171
28  com.apple.CoreFoundation         0x9bae3251 -[NSObject performSelector:withObject:] + 65
29  com.apple.AppKit                 0x9439ce4a -[NSApplication sendAction:to:from:] + 232
30  com.apple.AppKit                 0x9449039b -[NSMenuItem _corePerformAction] + 536
31  com.apple.AppKit                 0x94490034 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 171
32  com.apple.AppKit                 0x9448f6bd -[NSMenu _performActionWithHighlightingForItemAtIndex:sendAccessibilityNotification:] + 79
33  com.apple.AppKit                 0x9448f669 -[NSMenu _performActionWithHighlightingForItemAtIndex:] + 48
34  com.apple.AppKit                 0x944089a0 -[NSMenu performKeyEquivalent:] + 306
35  com.apple.AppKit                 0x94407414 -[NSApplication _handleKeyEquivalent:] + 594
36  com.apple.AppKit                 0x942fc0c9 -[NSApplication sendEvent:] + 5219
37  com.camerabits.PhotoMechanic     0x00090a97 -[CPMApp sendEvent:] + 71
38  com.apple.AppKit                 0x9428e946 -[NSApplication run] + 993
39  com.apple.AppKit                 0x94521031 NSApplicationMain + 1047
40  com.camerabits.PhotoMechanic     0x00003072 _start + 216
41  com.camerabits.PhotoMechanic     0x00002f99 start + 41


Is anyone working on compatibility updates to libSDL 1.2.x for Mac OS X 10.7? Is anyone else having these same crash issues?

Kind regards,

-Kirk

Kirk A. Baker
Senior Software Engineer
Camera Bits, Inc.
philstopford


Joined: 25 Sep 2009
Posts: 13
Yes. I see the same issues here under Lion DP4.
kbaker


Joined: 24 May 2011
Posts: 7
philstopford wrote:
Yes. I see the same issues here under Lion DP4.


Thanks Phil. I've filed a bug in the SDL Bugzilla bug tracker. The ID number is 1215.

I'll post here if there is any progress.

-Kirk
kbaker


Joined: 24 May 2011
Posts: 7
I've done some debugging on this issue.

CGDisplayBaseAddress() has been deprecated in 10.6 and while it still exists on 10.7, it now returns NULL instead of the display's base address. SDL_SetVideoMode() ends up calling a number of deprecated CG functions via the Quartz implementation including CGDisplayBaseAddress(). It is SDL_SetVideoMode()'s call to SDL_ClearSurface() that actually causes the crash when it tries to clear the frame buffer memory at address zero.

A new set of APIs has been added as of 10.6 and while they let you capture a display, they do not allow direct frame buffer access. Quartz or OpenGL are the only methods that can update a captured display.

The work to switch to the new APIs in the context of SDL is not trivial.

I downloaded a snapshot of the SDL 1.3 sources and see that, sadly, the Mac OS X implementation is still using the deprecated functions.

-Kirk
SDL 1.2.14 on Mac OS X 10.7
Ryan C. Gordon
Guest

Quote:
I downloaded a snapshot of the SDL 1.3 sources and see that, sadly, the
Mac OS X implementation is still using the deprecated functions.

SDL 1.3 uses OpenGL by default, even for "software" surfaces.

I imagine we have some CoreGraphics cruft to clean out still, but SDL
1.3 shouldn't be trying to write to the frame buffer. To be sure, we
definitely don't call CGDisplayBaseAddress() anymore. Maybe you have a
really old snapshot?

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL 1.2.14 on Mac OS X 10.7
Ryan C. Gordon
Guest

Quote:
CGDisplayBaseAddress() has been deprecated in 10.6 and while it still
exists on 10.7, it now returns NULL instead of the display's base
address.

Is this true on 32-bit programs, too, or did they only do this for
64-bit programs?

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: SDL 1.2.14 on Mac OS X 10.7
kbaker


Joined: 24 May 2011
Posts: 7
Ryan C. Gordon wrote:
Quote:
I downloaded a snapshot of the SDL 1.3 sources and see that, sadly, the
Mac OS X implementation is still using the deprecated functions.

SDL 1.3 uses OpenGL by default, even for "software" surfaces.

I imagine we have some CoreGraphics cruft to clean out still, but SDL
1.3 shouldn't be trying to write to the frame buffer. To be sure, we
definitely don't call CGDisplayBaseAddress() anymore. Maybe you have a
really old snapshot?


Not that specific function, but things like CGDisplaySwitchToMode() are still in use in 1.3 and it's deprecated in 10.6. I don't know if the remaining functions act differently in 10.7 or not.

I did get the tar.gz file from the main SDL page today. I think it was pretty current.

-Kirk
Re: SDL 1.2.14 on Mac OS X 10.7
kbaker


Joined: 24 May 2011
Posts: 7
Ryan C. Gordon wrote:
Quote:
CGDisplayBaseAddress() has been deprecated in 10.6 and while it still
exists on 10.7, it now returns NULL instead of the display's base
address.

Is this true on 32-bit programs, too, or did they only do this for
64-bit programs?


Our application is 32-bit only at this time. I can't speak for the functionality of CGDisplayBaseAddress() for 64-bit apps when running on 10.7.

-Kirk
SDL 1.2.14 on Mac OS X 10.7
Jjgod Jiang
Guest

On Thu, Jun 23, 2011 at 10:24 AM, kbaker wrote:
Quote:
Ryan C. Gordon wrote:
Quote:

I downloaded a snapshot of the SDL 1.3 sources and see that, sadly, the
Mac OS X implementation is still using the deprecated functions.



SDL 1.3 uses OpenGL by default, even for "software" surfaces.

I imagine we have some CoreGraphics cruft to clean out still, but SDL
1.3 shouldn't be trying to write to the frame buffer. To be sure, we
definitely don't call CGDisplayBaseAddress() anymore. Maybe you have a
really old snapshot?



Not that specific function, but things like CGDisplaySwitchToMode() are still in use in 1.3 and it's deprecated in 10.6. I don't know if the remaining functions act differently in 10.7 or not.

They still work, I've tried.

Quote:
I did get the tar.gz file from the main SDL page today. I think it was pretty current.

- Jiang
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org