Error code when exiting SDL

I get the following message when I exit the SDL program:

video memory protecting

I’m getting no core dumps or other signals to my program.

Is this a normal message when you exit SDL? It happens “at_exit()” so I
assume this is the SDL_Quit() routine. I have TTF_Quit() running
at_exit() as well.

I just want to make sure I’m not doing anything wrong to cause this
message to appear.–
Brian

Actually that’s not an error message. It’s a spurous debug message
that we have no control over, unless we want to hack the X11 sources
that is. I don’t know if it will go away with XFree86 4.0 or not.

-KWOn 31 Dec, hayward at slothmud.org wrote:

I get the following message when I exit the SDL program:

video memory protecting

I’m getting no core dumps or other signals to my program.

Is this a normal message when you exit SDL? It happens “at_exit()” so I
assume this is the SDL_Quit() routine. I have TTF_Quit() running
at_exit() as well.

I just want to make sure I’m not doing anything wrong to cause this
message to appear.

Thanks, that message gave me no info as to what it was referring to.
I just didn’t want my code to be doing anything wrong that might cause me
problems down the road.–
Brian

Actually that’s not an error message. It’s a spurous debug message
that we have no control over, unless we want to hack the X11 sources
that is. I don’t know if it will go away with XFree86 4.0 or not.

-KW

Is this a normal message when you exit SDL? It happens “at_exit()” so I
assume this is the SDL_Quit() routine. I have TTF_Quit() running
at_exit() as well.

atexit() is evil. I would seriously reconsider your program design if you're using it.

m.On Fri, Dec 31, 1999 at 02:26:25AM -0600, hayward at slothmud.org wrote:


Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone’s teeth get cleaner?"
http://lokigames.com/~briareos/ - Frank Zappa, re: the PMRC

Why is atexit() evil?

-KWOn 31 Dec, Michael Vance wrote:

atexit() is evil. I would seriously reconsider your program design if you're using it.

Just following the documentation for SDL :slight_smile:
All of the examples suggest using it.

Whats wrong with atexit()?–
Brian

atexit() is evil. I would seriously reconsider your program design if you're using it.

m.


Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone’s teeth get cleaner?"
http://lokigames.com/~briareos/ - Frank Zappa, re: the PMRC

Why is atexit() evil?

Because it invites program execution errors related to indeterminate
state. That is, you are much much more likely to make an error related
to uninstialized or indeterminate state during cleanup in an atexit()
call than you are in a shutdown routine that is called explicitly in
your program. Or, someone else has made a poor design decision around
atexit(), and because of the inability to unregister an atexit()
function, you must write workaround code anyway.

Case in point:

The 3DFX Mesa driver registers an atexit() handler that performs an
explicit context deletion, AND resets a reference count variable to

  1. If you have registered SDL_Quit() before you create a context (by
    calling SDL_SetVideoMode( …, SDL_OPENGL ) ), then the 3DFX handler
    will be called before your handler since it was registered
    after. The 3DFX handler munges the state and then you get a segfault
    when you double-free a pointer in your own glXDeleteContext inside of
    SDL_Quit().

While this is an obvious bug in Mesa, and should be fixed, it shows
the sort of nasty problems you can get into. The same thing goes for
registering signal handlers, I might add.

Other Evil™ things:

setuid root binaries
DGA (and its slow!)
VidMode
Fullscreen only 3D

Regards,

m.On Fri, Dec 31, 1999 at 10:31:42AM -0700, kwalker at aros.net wrote:


Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone’s teeth get cleaner?"
http://lokigames.com/~briareos/ - Frank Zappa, re: the PMRC

Just following the documentation for SDL :slight_smile:
All of the examples suggest using it.

Yeah, they should be changed. Bad Sam! Bad! I also insisted on the
NOPARACHUTE flag for SDL_Init.

Whats wrong with atexit()?

See previous post.

m.On Fri, Dec 31, 1999 at 11:37:13AM -0600, hayward at slothmud.org wrote:


Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone’s teeth get cleaner?"
http://lokigames.com/~briareos/ - Frank Zappa, re: the PMRC

Why is atexit() evil?

As I understand it, SDL uses atexit() for emergency cleanup before a
signal takes down the process. I do something similar in all of my
code, simply to release any global resources that I have captured.

Because it invites program execution errors related to indeterminate
state. That is, you are much much more likely to make an error related
to uninstialized or indeterminate state during cleanup in an atexit()
call than you are in a shutdown routine that is called explicitly in
your program.

If you just trust it in all cases where the program exits, then yes, you
are leaving yourself open – but if you have it for those cases where it’s
a choice between trying to clean up or requiring a reboot, then I think
it’s a valid decision.

As for indeterminate state, obviously it’s impossible to avoid entirely
in a preemptively threaded system, but in most cases it’s just a matter
of breaking operations into discrete tasks: functions to create objects
either return a completely constructed instance or destroy it safely if
allocation fails, functions that modify an object’s state know how to
roll back the state if the change fails.

Software parachutes aren’t an indicator of sloppy programming, simply an
added layer of protection in an imperfect world… the same way that you
wrap file/memory functions with error checking, not because you expect
them to fail, but because they might anyway.

Matt

/* Matt Slot, Bitwise Operator * One box, two box, yellow box, blue box. *

Other Evil™ things:

setuid root binaries

Ok

DGA (and its slow!)
VidMode

Fullscreen only 3D

As long as its an option?

Ack! Keep the trademark! :slight_smile:

Alan Carr
http://www.denizengames.com