Sat, 29 Dec 2007 06:16:35 +0000Fixed bug #497 SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 06:16:35 +0000] rev 4114
Fixed bug #497
Check all joysticks instead of stopping if one has been removed.

Sat, 29 Dec 2007 06:08:17 +0000Fixed bug #464 SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 06:08:17 +0000] rev 4113
Fixed bug #464
Added X1/X2 button constants

Sat, 29 Dec 2007 06:06:03 +0000Improved detection of mprotect() SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 06:06:03 +0000] rev 4112
Improved detection of mprotect()

Sat, 29 Dec 2007 05:30:20 +0000Updated version to 1.2.13 SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 05:30:20 +0000] rev 4111
Updated version to 1.2.13

Sat, 29 Dec 2007 05:20:51 +0000Updated version to 1.2.13 SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 05:20:51 +0000] rev 4110
Updated version to 1.2.13

Sat, 29 Dec 2007 05:18:33 +0000Made the mprotect() fix for SDL_SoftStretch() more general for hardened linux, etc. SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 05:18:33 +0000] rev 4109
Made the mprotect() fix for SDL_SoftStretch() more general for hardened linux, etc.

Sat, 29 Dec 2007 03:50:29 +0000Fixed bug #528 SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 03:50:29 +0000] rev 4108
Fixed bug #528
OpenBSD (and possibly others) do not have executable memory by default,
so use mprotect() to allow execution of dynamic assembly block.

Sat, 29 Dec 2007 02:34:53 +0000Erik Heckers fixed bug #493 SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 02:34:53 +0000] rev 4107
Erik Heckers fixed bug #493

Searching the installed man pages for SDL functions fails, e.g.
man -k SDL_ |grep Video
After investigating this I found that "makewhatis", the tool that generates
the "whatis" database, reads the SDL_* man pages, but doesn't produce
entries in the "whatis" database for the SDL_* man pages.
After some more debugging I found the reason is a missing space.
After editing SDL_Init.3(.gz) and replacing
SDL_Init\- Initializes SDL
SDL_Init \- Initializes SDL
everything works fine.
After running "makewhatis" I can successfully do a
man -k SDL_
and SDL_Init is listed in the output.

Sat, 29 Dec 2007 02:23:48 +0000Hans de Goede fixed bug #495 SDL-1.2
Sam Lantinga <> [Sat, 29 Dec 2007 02:23:48 +0000] rev 4106
Hans de Goede fixed bug #495

When running boswars: on a machine with intel
integrathed graphics it crashes when it tries to play the initial theora
splashscreen video:
X Error of failed request: BadAlloc (insufficient resources for operation)
Major opcode of failed request: 140 (XVideo)
Minor opcode of failed request: 19 ()
Serial number of failed request: 25
Current serial number in output stream: 26
boswars: xcb_xlib.c:41: xcb_xlib_lock: Assertion `!c->xlib.lock' failed.

I recognized this problem from a few years back, when I encountered it while
working on the Xv blitter for xmame. The problem is that for some reason
creation the Xvport and XvImage succeeds, and failure (lack of resources / hw
capability?) is only indicated during the first XvPut[Shm]Image. I've written a
patch for SDL using the work around for this I developed for xmame (and which
is still used successfully in xmame after many years of usage).

I'll admit it isn't very pretty, but after investigating several possibilities
this was the best option, any other fixes would need changes to the SDL api and

Fri, 28 Dec 2007 22:05:17 +0000Date: Thu, 27 Dec 2007 07:38:25 +0000 SDL-1.2
Sam Lantinga <> [Fri, 28 Dec 2007 22:05:17 +0000] rev 4105
Date: Thu, 27 Dec 2007 07:38:25 +0000
From: John Bartholomew
Subject: [SDL] SDL Semaphore implementation broken on Windows?

Over the past couple of days, I've been battling with SDL, SDL_Mixer and SMPEG to try to find an audio hang bug. I believe I've found the problem, which I think is a race condition inside SDL's semaphore implementation (at least the Windows implementation). The semaphore code uses Windows' built in semaphore functions, but it also maintains a separate count value. This count value is updated with bare increment and decrement operations in SemPost and SemWaitTimeout - no locking primitives to protect them.

In tracking down the apparent audio bug, I found that at some point a semaphore's count value was being decremented to -1, which is clearly not a valid value for it to take.

I'm still not certain exactly what sequence of operations is occuring for this to happen, but I believe that overall it's a race condition between a thread calling SemPost (which increments the count) and the thread on the other end calling SemWait (which decrements it).

I will try to make a test case to verify this, but I'm not sure if I'll be able to (threading errors being difficult to reproduce even in the best circumstances).

However, assuming this is the cause of my problems, there is a very
simple fix:
Windows provides InterlockedIncrement() and InterlockedDecrement()
functions to perform increments and decrements which are guaranteed to be atomic. So the fix is in thread/win32/SDL_syssem.c: replace occurrences of --sem->count with InterlockedDecrement(&sem->count); and replace occurrences of ++sem->count with InterlockedIncrement(&sem->count);

This is using SDL v1.2.12, built with VC++ 2008 Express, running on a
Core 2 duo processor.