SDL_FreeRW on Win64 causes ntdll exception

Can someone verify this bug? When compiling and running SDL 2.0 64bit
(compiled from latest sources) on Windows 7 64bit, attempts to free a
reference to file based SDL_RWops causes a fatal exception to be raise in
ntdll at RtlUnicodeToCustomCPN.

00000000771E40F2 eb00 jmp 0x771e40f4 <ntdll!RtlUnicodeToCustomCPN+724>

Here is the code I am using. FileName string uses1 byte per char.

function FileExists(const FileName: string): Boolean;
var
F: PSDL_RWops;
begin
F := SDL_RWFromFile(PChar(FileName), ‘rb’);
Result := F <> nil;
if Result then
begin
SDL_RWClose(F);
SDL_FreeRW(F); // fatal ntdll exception here
end;
end;

The above works fine on when compiling and running a 32 bit application on
the same OS. The above also works fine on linux both 32 and 64 bit.

SDL_FreeRW(F) should ONLY be called against an F that was created with F
= SDL_AllocRW()
So the below code is incorrect - the SDL_FreeRW should be removed.

–AndreasOn 5/12/2013 12:00 PM, Anthony Walter wrote:

Can someone verify this bug? When compiling and running SDL 2.0 64bit
(compiled from latest sources) on Windows 7 64bit, attempts to free a
reference to file based SDL_RWops causes a fatal exception to be raise
in ntdll at RtlUnicodeToCustomCPN.

00000000771E40F2 eb00 jmp 0x771e40f4 <ntdll!RtlUnicodeToCustomCPN+724>

Here is the code I am using. FileName string uses1 byte per char.

function FileExists(const FileName: string): Boolean;
var
F: PSDL_RWops;
begin
F := SDL_RWFromFile(PChar(FileName), ‘rb’);
Result := F <> nil;
if Result then
begin
SDL_RWClose(F);
SDL_FreeRW(F); // fatal ntdll exception here
end;
end;

The above works fine on when compiling and running a 32 bit
application on the same OS. The above also works fine on linux both 32
and 64 bit.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah, SDL_RWclose() does the freeing for you.

Jonny DOn Sun, May 12, 2013 at 3:16 PM, Andreas Schiffler wrote:

SDL_FreeRW(F) should ONLY be called against an F that was created with F
= SDL_AllocRW()
So the below code is incorrect - the SDL_FreeRW should be removed.

–Andreas

On 5/12/2013 12:00 PM, Anthony Walter wrote:

Can someone verify this bug? When compiling and running SDL 2.0 64bit
(compiled from latest sources) on Windows 7 64bit, attempts to free a
reference to file based SDL_RWops causes a fatal exception to be raise in
ntdll at RtlUnicodeToCustomCPN.

00000000771E40F2 eb00 jmp 0x771e40f4 <ntdll!RtlUnicodeToCustomCPN+724>

Here is the code I am using. FileName string uses1 byte per char.

function FileExists(const FileName: string): Boolean;
var
F: PSDL_RWops;
begin
F := SDL_RWFromFile(PChar(FileName), ‘rb’);
Result := F <> nil;
if Result then
begin
SDL_RWClose(F);
SDL_FreeRW(F); // fatal ntdll exception here
end;
end;

The above works fine on when compiling and running a 32 bit application on
the same OS. The above also works fine on linux both 32 and 64 bit.


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org