Atexit assertion failure

All kinds of SDL example code shows code like thi:

atexit(SDL_Quit);

I have tried many times to use this without success. It throws an assertion. Here is what the debugheap.c code says (Win32)

    /*
     * If this ASSERT fails, a bad pointer has been passed in. It may be
     * totally bogus, or it may have been allocated from another heap.
     * The pointer MUST come from the 'local' heap.
     */
    _ASSERTE(_CrtIsValidHeapPointer(pUserData));

I am totally new to SDL and somewhat rusty at C++ (Using MSVC++ 5.)
Any help would be appreciated!

Thanks,

–Warren Schwader

If it’s the problem is what I think it is (does the assertion fail when you exit the program?), try passing SDL_NO_PARACHUTE to SDL_Init(). I inquired at better ways to fix the problem about a week ago on this list, but no replies as of yet, so I’ll assume that either a) nobody knows a better way, or b) that is the best way.

If any of the devs out there are looking for something to do, the problem seems to be that the doexit() handler (which runs all the atexit()-registered functions), is getting hold of a NULL pointer somewhere, but only when the Parachute is active. Maybe the parachute code in SDL_Init() is calling atexit() with a NULL value somewhere? (I haven’t had time to muck around in SDL’s source this week, but I’ll have a look in a week or two if noone else does)

  • Silicon----- Original Message -----
    From: Warren Schwader
    To: sdl at libsdl.org
    Sent: Wednesday, October 22, 2003 1:33 AM
    Subject: [SDL] atexit assertion failure

    All kinds of SDL example code shows code like thi:

    atexit(SDL_Quit);

    I have tried many times to use this without success. It throws an assertion. Here is what the debugheap.c code says (Win32)

        /*
         * If this ASSERT fails, a bad pointer has been passed in. It may be
         * totally bogus, or it may have been allocated from another heap.
         * The pointer MUST come from the 'local' heap.
         */
        _ASSERTE(_CrtIsValidHeapPointer(pUserData));
    

    I am totally new to SDL and somewhat rusty at C++ (Using MSVC++ 5.)
    Any help would be appreciated!

    Thanks,

    –Warren Schwader


    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.528 / Virus Database: 324 - Release Date: 10/16/2003

Actually I get the assertion when the atexit call is made to register SDL_Quit.----- Original Message -----
From: John Silicon
To: sdl at libsdl.org
Sent: Wednesday, October 22, 2003 12:01 PM
Subject: Re: [SDL] atexit assertion failure

If it’s the problem is what I think it is (does the assertion fail when you exit the program?), try passing SDL_NO_PARACHUTE to SDL_Init(). I inquired at better ways to fix the problem about a week ago on this list, but no replies as of yet, so I’ll assume that either a) nobody knows a better way, or b) that is the best way.

If any of the devs out there are looking for something to do, the problem seems to be that the doexit() handler (which runs all the atexit()-registered functions), is getting hold of a NULL pointer somewhere, but only when the Parachute is active. Maybe the parachute code in SDL_Init() is calling atexit() with a NULL value somewhere? (I haven’t had time to muck around in SDL’s source this week, but I’ll have a look in a week or two if noone else does)

  • Silicon
    ----- Original Message -----
    From: Warren Schwader
    To: sdl at libsdl.org
    Sent: Wednesday, October 22, 2003 1:33 AM
    Subject: [SDL] atexit assertion failure

    All kinds of SDL example code shows code like thi:

    atexit(SDL_Quit);

    I have tried many times to use this without success. It throws an assertion. Here is what the debugheap.c code says (Win32)

        /*
         * If this ASSERT fails, a bad pointer has been passed in. It may be
         * totally bogus, or it may have been allocated from another heap.
         * The pointer MUST come from the 'local' heap.
         */
        _ASSERTE(_CrtIsValidHeapPointer(pUserData));
    

    I am totally new to SDL and somewhat rusty at C++ (Using MSVC++ 5.)
    Any help would be appreciated!

    Thanks,

    –Warren Schwader


    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.528 / Virus Database: 324 - Release Date: 10/16/2003

Can you give a line number for that assert? I’ll see if I can trace pUserData to it.----- Original Message -----
From: Warren Schwader
To: sdl at libsdl.org
Sent: Wednesday, October 22, 2003 3:44 PM
Subject: Re: [SDL] atexit assertion failure

Actually I get the assertion when the atexit call is made to register SDL_Quit.
----- Original Message -----
From: John Silicon
To: sdl at libsdl.org
Sent: Wednesday, October 22, 2003 12:01 PM
Subject: Re: [SDL] atexit assertion failure

If it's the problem is what I think it is (does the assertion fail when you exit the program?), try passing SDL_NO_PARACHUTE to SDL_Init().  I inquired at better ways to fix the problem about a week ago on this list, but no replies as of yet, so I'll assume that either a) nobody knows a better way, or b) that is the best way.

If any of the devs out there are looking for something to do, the problem seems to be that the doexit() handler (which runs all the atexit()-registered functions), is getting hold of a NULL pointer somewhere, but only when the Parachute is active.  Maybe the parachute code in SDL_Init() is calling atexit() with a NULL value somewhere? (I haven't had time to muck around in SDL's source this week, but I'll have a look in a week or two if noone else does)

- Silicon
  ----- Original Message ----- 
  From: Warren Schwader 
  To: sdl at libsdl.org 
  Sent: Wednesday, October 22, 2003 1:33 AM
  Subject: [SDL] atexit assertion failure


  All kinds of SDL example code shows code like thi:

  atexit(SDL_Quit);

  I have tried many times to use this without success.  It throws an assertion.  Here is what the debugheap.c code says (Win32)

          /*
           * If this ASSERT fails, a bad pointer has been passed in. It may be
           * totally bogus, or it may have been allocated from another heap.
           * The pointer MUST come from the 'local' heap.
           */
          _ASSERTE(_CrtIsValidHeapPointer(pUserData));


  I am totally new to SDL and somewhat rusty at C++ (Using MSVC++ 5.)
  Any help would be appreciated!

  Thanks,

  --Warren Schwader


  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.528 / Virus Database: 324 - Release Date: 10/16/2003


  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.530 / Virus Database: 325 - Release Date: 10/22/2003