SDL Win32 crashes at shutdown after repeated (de)allocation of hardware surfaces

I have a sine wave effect where I take a graphic stored in a hardware
surface, create a new surface of the same format using SDL_ConvertSurface,
flood fill it with a transparent background color, and then copy rows of the
original surface to the new surface using variously-offset rect blits.

The temporary surface is destroyed every frame and a new one is created. As
long as I either run in windowed mode or pass SDL_SWSURFACE in the flags
parameter to SDL_ConvertSurface, the program functions perfectly. If I, on
the other hand, pass in the source surface’s flags or pass in the explicit
value SDL_HWSURFACE, the program still runs perfectly yet crashes after
program exit in SDL.dll.

I have commented out all the drawing code being called on the surface and
the error still happens, indicating it is the SDL_HWSURFACE allocation and
deallocation which is causing this crash. The problem seems to stem directly
from something within SDL_ConvertSurface.

I can alter my program to use SWSURFACE for this effect, but it is much
slower, and also, I have a feeling this same problem will pop up again in
other places.

James Haley

Hello !

Is it possible for you to
put together a small test app
that shows these problems ?

CU

Hello James,

Thursday, April 27, 2006, 6:27:43 PM, you wrote:

JH> I have a sine wave effect where I take a graphic stored in a hardware
JH> surface, create a new surface of the same format using SDL_ConvertSurface,
JH> flood fill it with a transparent background color, and then copy rows of the
JH> original surface to the new surface using variously-offset rect blits.

The “Plasma” effect? :slight_smile:

JH> The temporary surface is destroyed every frame and a new one is created.

Why on earth are you doing that?–
Best regards,
Peter mailto:@Peter_Mulholland

I can, however it may take a while to get it going as my current problem is
embedded in an expansive game engine (I have, however, narrowed the problem
down to this exact code). When I do, should I paste the source in an email
or upload it somewhere and link to it? I’m new to this mailing list :)>From: “Torsten Giebl”

Reply-To: “A list for developers using the SDL library.
(includesSDL-announce)”
To: "A list for developers using the SDL library. (includes
SDL-announce)"
Subject: Re: [SDL] SDL Win32 crashes at shutdown after repeated
(de)allocation of hardware surfaces
Date: Thu, 27 Apr 2006 19:33:10 +0200 (CEST)
MIME-Version: 1.0
Received: from twomix.devolution.com ([206.58.251.131]) by
bay0-mc10-f4.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Thu,
27 Apr 2006 10:32:10 -0700
Received: from localhost([127.0.0.1] helo=twomix.devolution.com
ident=mailman)by twomix.devolution.com with esmtp (Exim 4.50)id
1FZALZ-0005Dz-4wfor @James_Haley; Thu, 27 Apr 2006 10:32:09 -0700
Received: from syntheticsw.com ([217.160.130.56])by twomix.devolution.com
with esmtp (Exim 4.50) id 1FZALH-00057R-MAfor sdl at libsdl.org; Thu, 27 Apr
2006 10:31:51 -0700
Received: from localhost (localhost [127.0.0.1])by syntheticsw.com
(Postfix) with ESMTP id 5042B14762Ffor ; Thu, 27 Apr 2006
19:33:12 +0200 (CEST)
Received: from syntheticsw.com ([127.0.0.1])by localhost (syntheticsw.com
[127.0.0.1]) (amavisd-new, port 10024)with ESMTP id 05361-10 for
;Thu, 27 Apr 2006 19:33:10 +0200 (CEST)
Received: by syntheticsw.com (Postfix, from userid 33)id 34DCE14763F; Thu,
27 Apr 2006 19:33:10 +0200 (CEST)
Received: from 141.99.122.11 (SquirrelMail authenticated user wizard)by
mail.syntheticsw.com with HTTP;Thu, 27 Apr 2006 19:33:10 +0200 (CEST)
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
References:
User-Agent: SquirrelMail/1.5.1 [CVS]
X-Virus-Scanned: Debian amavisd-new at syntheticsw.com
X-Virus-Scanner: Scanned by CLAMAV on devolution.com
X-BeenThere: sdl at libsdl.org
X-Mailman-Version: 2.1.7
Precedence: list
List-Id: “A list for developers using the SDL library.
(includesSDL-announce)” <sdl.libsdl.org>
List-Unsubscribe:
http://www.libsdl.org/mailman/listinfo/sdl,<mailto:sdl-request at libsdl.org?subject=unsubscribe>
List-Archive: http://www.libsdl.org/pipermail/sdl
List-Post: <mailto:sdl at libsdl.org>
List-Help: <mailto:sdl-request at libsdl.org?subject=help>
List-Subscribe:
http://www.libsdl.org/mailman/listinfo/sdl,<mailto:sdl-request at libsdl.org?subject=subscribe>
Errors-To: sdl-bounces+haleyjd=hotmail.com at libsdl.org
X-Virus-Scanner: Scanned by CLAMAV on devolution.com
Return-Path: sdl-bounces+haleyjd=hotmail.com at libsdl.org
X-OriginalArrivalTime: 27 Apr 2006 17:32:11.0567 (UTC)
FILETIME=[842CE3F0:01C66A20]

Hello !

Is it possible for you to
put together a small test app
that shows these problems ?

CU


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

Hello !

I can, however it may take a while to get it going as my current problem
is embedded in an expansive game engine (I have, however, narrowed the
problem down to this exact code). When I do, should I paste the source in
an email or upload it somewhere and link to it? I’m new to this mailing
list :slight_smile:

If it is only one or two pages send as an email,
if more post a link here.

CU

Oops! After much more carefully observing this in the debugger I realized
this was my own fault after all. I had mindlessly declared one of my Surface
objects as a global, failing to realize this would cause its destructor to
be invoked well after SDL_Quit was already called. You can’t be too careful
with that kind of stuff.

James Haley>From: “Torsten Giebl”

Hello !

I can, however it may take a while to get it going as my current problem
is embedded in an expansive game engine (I have, however, narrowed the
problem down to this exact code). When I do, should I paste the source
in
an email or upload it somewhere and link to it? I’m new to this mailing
list :slight_smile:

If it is only one or two pages send as an email,
if more post a link here.

CU


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

Hello !

Oops! After much more carefully observing this in the debugger I realized
this was my own fault after all. I had mindlessly declared one of my
Surface
objects as a global, failing to realize this would cause its destructor to
be invoked well after SDL_Quit was already called. You can’t be too
careful with that kind of stuff.

No problem. It is always good
if problems are solved.

CU