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:

SDL_Surface *intro, *temp;

temp = IMG_Load(“images/intro.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);

It crashes in the last line (the SDL_FreeSurface(intro)).

MSVC dumps this in the debug window:

HEAP[test.exe]: Invalid Address specified to RtlFreeHeap( 900000, abba00 )

It also doesn’t crash if I remove the SDL_BlitSurface() call above. So the
blit is transforming the surface in some way that it can’t be freed withing
crashing in fullscreen mode (hardware surface, double buffer).

Sure sucks trying to debug full screen SDL apps that crash! :slight_smile:

-Jason

Jason Hoffoss wrote:

SDL_BlitSurface(intro, NULL, screen, NULL);

SDL_FreeSurface(intro);

what if you stick an SDL_Flip(screen); before the SDL_FreeSurface…
also, how about an SDL_Quit() at the end…
and also, assertion failures may not call SDL_Quit, which would be ugly…assert is already ugly enough…–
-==-
Jon Atkins
http://jcatki.2y.net/

Jason Hoffoss wrote:

SDL_BlitSurface(intro, NULL, screen, NULL);

SDL_FreeSurface(intro);

what if you stick an SDL_Flip(screen); before the SDL_FreeSurface…

No difference. I had it that way before I reduced it to the minimum code
able to reproduce the bug.

also, how about an SDL_Quit() at the end…

There’s no SDL_Init() in this example either. Besides, it crashes before it
would get to the SDL_Quit() anyway. And when it crashes, I can’t see
anything because DirectX has the screen. I have to hit enter (to close the
dialog stating what the error was, but unfortunately, I don’t get to know
what), and then press Alt-F5 to stop the program, at which point DirectX
shuts down and I get to see my desktop again. LIke I said, it’s not fun to
try and debug fullscreen mode.

and also, assertion failures may not call SDL_Quit, which would be
ugly…assert is already ugly enough…

Actually, this assert() is really just a macro, so it’s not as bad as you
think. I can have it call SDL_Quit() if it fails, etc.

-Jason

----- Original Message -----
From: jcatki@jcatki.2y.net (Jonathan Atkins)
To:
Sent: Monday, March 18, 2002 5:06 AM
Subject: Re: [SDL] Crashing problem

Hello!

And when it crashes, I can’t see anything because DirectX
has the screen. I have to hit enter (to close the
dialog stating what the error was, but unfortunately, I don’t
get to know what),

…because you don’t get to see the message box?
Perhaps you can capture it by pressing Alt-Print
and then paste it into a painting application.

Ciao,
Eike

RE: [SDL] Crashing problemHeh, I tried that, but just got a nice capture of the DirectX screen I was already looking at. :frowning:

-Jason----- Original Message -----
From: eike Sauer
To: sdl at libsdl.org
Sent: Monday, March 18, 2002 10:09 AM
Subject: RE: [SDL] Crashing problem

Hello!

And when it crashes, I can’t see anything because DirectX
has the screen. I have to hit enter (to close the
dialog stating what the error was, but unfortunately, I don’t
get to know what),

…because you don’t get to see the message box?
Perhaps you can capture it by pressing Alt-Print
and then paste it into a painting application.

Ciao,
Eike

At 10:29 3/18/2002 -0500, you wrote:

Heh, I tried that, but just got a nice capture of the DirectX screen I was
already looking at. :frowning:

If the message box has the focus you can just press the ordinary
Ctrl+C (Copy to clipboard) and paste it somewhere.

Regards,
Dimitri>> > And when it crashes, I can’t see anything because DirectX

has the screen. I have to hit enter (to close the
dialog stating what the error was, but unfortunately, I don’t
get to know what),

…because you don’t get to see the message box?
Perhaps you can capture it by pressing Alt-Print
and then paste it into a painting application.

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.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Ctrl+PrScr gives you the entire screen.
Alt+PrScr gives you the window that has focus.

However even Alt+PrScr won’t help if the current window is obscured by an
"Always on top" window (e.g. by the DDraw window). It just gives you the
"visible" screen but clipped to the rect of the active window. :frowning:

I had a handy program for dumping the text of all windows into a file; you
can write one yourself in 10 lines (recursively enumerate all child windows
starting with the desktop and dump everything to a nicely indented file that
gives you the window text/caption for every window – this way you’ll see
the dialog as well as the stuff it contains).

Ctrl+C won’t do anything.

V.> >Heh, I tried that, but just got a nice capture of the

DirectX screen I was

already looking at. :frowning:

If the message box has the focus you can just press the ordinary
Ctrl+C (Copy to clipboard) and paste it somewhere.

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

----- Original Message -----
From: slouken@devolution.com (Sam Lantinga)
To:
Sent: Monday, March 18, 2002 11:51 AM
Subject: Re: [SDL] Crashing problem