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?
Hi,

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.

Fri, 28 Dec 2007 20:39:31 +0000Fixed fatbuild.sh script for building on Mac OS X 10.5 SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 20:39:31 +0000] rev 4104
Fixed fatbuild.sh script for building on Mac OS X 10.5
The minimum PPC SDK is 10.3.9

Fri, 28 Dec 2007 18:15:43 +0000Date: Wed, 14 Nov 2007 22:20:27 -0500 SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 18:15:43 +0000] rev 4103
Date: Wed, 14 Nov 2007 22:20:27 -0500
From: Calvin Vette
Subject: Fix to compile SDL-1.2 SVN on OS X Leopard

I found I needed to add a conditional check for Leopard to compile
cleanly on 1.2-SVN (20071114):

#include <AudioUnit/AudioUnit.h>
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
#include <AudioUnit/AUNTComponent.h>
#endif

where there is now just:
#include <AudioUnit/AudioUnit.h>

Fri, 28 Dec 2007 18:07:59 +0000Date: Thu, 15 Nov 2007 10:33:01 +0100 SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 18:07:59 +0000] rev 4102
Date: Thu, 15 Nov 2007 10:33:01 +0100
From: "Marco Lopes"
Subject: Compiling with Intel compiler fails

I~Rve recently bought the Intel Compiler 10 for another project and decided
to compile SDL with it as well.

I was very surprised when it failed to compile because of the function:

Error 5 error: label "endS16" was referenced but not
defined ..\..\src\audio\SDL_mixer_MMX_VC.c

Fri, 28 Dec 2007 08:11:26 +0000Oskar Linde fixed bug #507 SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 08:11:26 +0000] rev 4101
Oskar Linde fixed bug #507

Trackpad scrolling on OSX is broken. Scrolling up/slightly right gets
translated into a Down event in SDL. The following patch fixes this extremely
irritating issue:

Fri, 28 Dec 2007 08:06:36 +0000Stephen Hurd fixed bug #505 SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 08:06:36 +0000] rev 4100
Stephen Hurd fixed bug #505

Borland compilers have the alloca() prototype in malloc.h as with WATCOM.

Fri, 28 Dec 2007 08:00:30 +0000Brian Fisher fixed bug #513 SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 08:00:30 +0000] rev 4099
Brian Fisher fixed bug #513

If an app requests a 24-bit opengl mode on a machine with a 32-bit desktop with
the windib video backend, then when exiting fullscreen the desktop resolution
is not restored

The reason this is, is because the windib backend restores the desktop
resolution when exiting fullscreen in DIB_SetVideoMode when it finds that the
last request was for fullscreen by checking the original flags on the video
surface. However, if the bits per pixel requested is different than current
surface, the video surface is recreated and the original video flags are lost.
So the check to see if we were exiting fullscreen fails.

below is a patch to SDL_dibvideo.c that solves the problem by using the
original flags in all cases.

thanks!

Fri, 28 Dec 2007 07:52:19 +0000Fixed typo in docs, fixing bug #520 SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 07:52:19 +0000] rev 4098
Fixed typo in docs, fixing bug #520

Fri, 28 Dec 2007 07:50:01 +0000Removed stray C++ comment SDL-1.2
Sam Lantinga [Fri, 28 Dec 2007 07:50:01 +0000] rev 4097
Removed stray C++ comment

Thu, 27 Dec 2007 13:59:41 +0000Fixed crash when given video modes > 32 bpp SDL-1.2
Sam Lantinga [Thu, 27 Dec 2007 13:59:41 +0000] rev 4096
Fixed crash when given video modes > 32 bpp