Crashing problem - works OK here

Hi,

just put together a complete minimal-ish example :

–8<-------------------------------------------------
#include “sdl.h”
#include “sdl_image.h”
#include “assert.h”
#include “stdlib.h”

void test( SDL_Surface *screen )
{
SDL_Surface *intro, *temp;

temp = IMG_Load(“images/pngbar.png”);
assert(temp);
intro = SDL_DisplayFormat(temp);
assert(intro);
SDL_FreeSurface(temp);

SDL_SetAlpha(intro, SDL_SRCALPHA, 128);
SDL_BlitSurface(intro, NULL, screen, NULL);

SDL_FreeSurface(intro);
}

int main( int argc, char *argv[] )
{
SDL_Surface *screen;
int width, height, bpp;
Uint32 videoflags;
SDL_Event event;
int done;

width = 640; height = 480; bpp = 16;
videoflags = SDL_SWSURFACE;
//videoflags |= SDL_FULLSCREEN;

if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
fprintf(stderr, “Couldn’t initialize SDL: %s\n”,SDL_GetError());
exit(1);
}

screen = SDL_SetVideoMode( width, height, bpp, videoflags );
if ( screen == NULL )
{
fprintf( stderr, “Couldn’t set display mode: %s\n”, SDL_GetError() );
SDL_Quit();
exit(2);
}

test( screen );

done = 0;
while ( !done && SDL_WaitEvent( &event ) )
{
switch( event.type )
{
case SDL_KEYDOWN:
if ( event.key.keysym.sym == SDLK_ESCAPE )
done = 1;
break;
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
SDL_Quit();
return 0;
}
---------------------------------------------->8-----

this works fine on my Win2K box in windowed or fullscreen.
The PNG image is an example file supplied with libpng-1.0
Compiled with VC6.0-SP4 using recent SDL CVS (~28-Feb-2002)

I recently had a “problem” with the latest official nVidia drivers
(admittedly for 9x/ME): worked fine in a window but everything
crashed like a bastard in fullscreen mode - switched back to
12.41 and all OK again,

cheers,
John.> ----- Original Message -----

From: jason@hoffoss.com (Jason Hoffoss)
To:
Sent: Tuesday, March 19, 2002 1:35 PM
Subject: Re: [SDL] Crashing problem

----- Original Message -----
From: “Sam Lantinga”
To:
Sent: Monday, March 18, 2002 11:51 AM
Subject: Re: [SDL] Crashing problem

I’ve got a problem with crashing in full screen mode in Windows 2000.
It

doesn’t crash in windowed mode, though. Playing around a lot, I
finally

narrowed it down to this minimal example reproducing it:

Does this happen with the latest CVS source?
http://www.libsdl.org/cvs.html
Make sure when you build the DLL that you copy it into the right
directory

for testing.

Yes, still crashes with the same problem. Using CVS SDL12 gotten about 20
minutes ago.

-Jason


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,

just put together a complete minimal-ish example :

–8<-------------------------------------------------
#include “sdl.h”
#include “sdl_image.h”
#include “assert.h”
#include “stdlib.h”

void test( SDL_Surface *screen )
{
SDL_Surface *intro, *temp;

temp = IMG_Load(“images/pngbar.png”);
assert(temp);
intro = SDL_DisplayFormat(temp);
assert(intro);
SDL_FreeSurface(temp);

SDL_SetAlpha(intro, SDL_SRCALPHA, 128);
SDL_BlitSurface(intro, NULL, screen, NULL);

SDL_FreeSurface(intro);
}

int main( int argc, char *argv[] )
{
SDL_Surface *screen;
int width, height, bpp;
Uint32 videoflags;
SDL_Event event;
int done;

width = 640; height = 480; bpp = 16;
videoflags = SDL_SWSURFACE;
//videoflags |= SDL_FULLSCREEN;

if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
fprintf(stderr, “Couldn’t initialize SDL: %s\n”,SDL_GetError());
exit(1);
}

screen = SDL_SetVideoMode( width, height, bpp, videoflags );
if ( screen == NULL )
{
fprintf( stderr, “Couldn’t set display mode: %s\n”, SDL_GetError() );
SDL_Quit();
exit(2);
}

test( screen );

done = 0;
while ( !done && SDL_WaitEvent( &event ) )
{
switch( event.type )
{
case SDL_KEYDOWN:
if ( event.key.keysym.sym == SDLK_ESCAPE )
done = 1;
break;
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
SDL_Quit();
return 0;
}
---------------------------------------------->8-----

this works fine on my Win2K box in windowed or fullscreen.
The PNG image is an example file supplied with libpng-1.0
Compiled with VC6.0-SP4 using recent SDL CVS (~28-Feb-2002)

Ya, this works for me too. But try adding SDL_DOUBLEBUF | SDL_HWSURFACE to
your videoflags when you create the screen. That’s when it crashes on me.

I recently had a “problem” with the latest official nVidia drivers
(admittedly for 9x/ME): worked fine in a window but everything
crashed like a bastard in fullscreen mode - switched back to
12.41 and all OK again,

Well, I’ve got a Voodoo 3 still, so this shouldn’t be an issue for me. :slight_smile:

-Jason

----- Original Message -----
From: john@johnnypops.demon.co.uk (John Popplewell)
To:
Sent: Tuesday, March 19, 2002 12:10 PM
Subject: Re: [SDL] Crashing problem - works OK here