The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_FreeRW on Win64 causes ntdll exception
Anthony Walter
Guest

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 on Win64 causes ntdll exception
Andreas Schiffler
Guest

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:

Quote:
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.


Quote:
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_FreeRW on Win64 causes ntdll exception
Jonny D


Joined: 12 Sep 2009
Posts: 932
Yeah, SDL_RWclose() does the freeing for you.

Jonny D



On Sun, May 12, 2013 at 3:16 PM, Andreas Schiffler wrote:
Quote:
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:



Quote:
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.




Quote:
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org