SDL Bug (?): OS X, SDL_INIT_EVENTTHREAD and SDL_Delay

I have found that the following code:

int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_EVERYTHING|SDL_INIT_EVENTTHREAD);

SDL_SetVideoMode(640, 480, 0, 0);

SDL_Delay(1000);
SDL_Quit();
return(0);

}

Causes a crash at SDL_Delay with the signal EXC_BAD_ADDRESS.
SDL_WaitEvent causes a similar crash, presumably because it depends
upon SDL_Delay internally. When obtaining a crash with the following
code:

int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_EVERYTHING|SDL_INIT_EVENTTHREAD);

SDL_SetVideoMode(640, 480, 0, 0);

SDL_Event ev;
SDL_WaitEvent(&ev);
SDL_Quit();
return(0);

}

My debugger reports that Thread-1 (the thread containing the code I
have written) is in a select in SDL_Delay at the time of the crash and
Thread-2 (the event thread) is in QZ_PumpEvents. The EXC_BAD_ADDRESS
seems to occur in Thread-2.

Have I simply misunderstood SDL_INIT_EVENTTHREAD or is this a genuine bug?

I am using SDL 1.2.9 with XCode 2.2 (including “gcc version 4.0.1
(Apple Computer, Inc. build 5247)”) under Mac OS X v10.4.3 on a 667Mhz
G4 Powerbook with 16mb ATI Mobility Radeon graphics card and 768mb
RAM.

I do not have a debug version of SDL built so cannot trap the exact
line at which the problem occurs within the SDL source. If necessary I
can attempt to remedy this.

-Thomas

Thomas Harte <thomas.harte gmail.com> writes:

I have found that the following code:

int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_EVERYTHING|SDL_INIT_EVENTTHREAD);

SDL_SetVideoMode(640, 480, 0, 0);

SDL_Delay(1000);
SDL_Quit();
return(0);
}

Causes a crash at SDL_Delay with the signal EXC_BAD_ADDRESS.
SDL_WaitEvent causes a similar crash, presumably because it depends
upon SDL_Delay internally. >
Have I simply misunderstood SDL_INIT_EVENTTHREAD or is this a genuine bug?

I am using SDL 1.2.9 with XCode 2.2 (including “gcc version 4.0.1
(Apple Computer, Inc. build 5247)”) under Mac OS X v10.4.3 on a 667Mhz
G4 Powerbook with 16mb ATI Mobility Radeon graphics card and 768mb
RAM.

I do not have a debug version of SDL built so cannot trap the exact
line at which the problem occurs within the SDL source. If necessary I
can attempt to remedy this.

-Thomas

Hi,

I’m not entirely sure, but I think that OSX is one of the OSes where
the SDL_INIT_EVENTTHREAD is quite simply not implemented. At least,
that is what I remember of 1.2.7 . Check the change log and if
nobody added support for this since then I think that that will explain
the problems your having.

Best wishes,
Thijske

int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_EVERYTHING|SDL_INIT_EVENTTHREAD);

SDL_SetVideoMode(640, 480, 0, 0);

SDL_Delay(1000);
SDL_Quit();
return(0);
}

I’m pretty sure EVENTTHREAD doesn’t work on Mac OS X (and probably
shouldn’t be used anywhere…maybe we should deprecate that…)

–ryan.

I’m pretty sure EVENTTHREAD doesn’t work on Mac OS X (and probably
shouldn’t be used anywhere…maybe we should deprecate that…)

Latest in CVS doesn’t crash anymore, but EVENTTHREAD still won’t work.

–ryan.