   SDL Stops Receiving System Events
  I'm loading/using SDL from a dynamically loaded shared object and, for whatever reason, it seems to quite randomly stop receiving system events. That is, I can't close my program because SDL_QUIT, SDL_KEYUP, and SDL_KEYDOWN are never processed! I'm not sure why this is happening.Like I said, all of the SDL code is in a shared object that is dynamically loaded at runtime. I imagine this has something to do with this, but I'm not sure why or how, especially since it seems to be random. It happens quite frequently though, and can be reproduced by simply "abusing" the display window (minimizing, moving, placing in another workspace, etc. all seem to trigger it).I'm using SDL_PeepEvents() to read all of the events I'm interested in (along with a call to SDL_PumpEvents() before hand, once per cycle). I've used this pattern before without problems, but maybe that approach doesn't work in these circumstances?Any ideas? Input is greatly appreciated. Thanks! :-)   
  Also, in case it helps, I'm using SDL with OpenGL, using C++ on a 64-bit Linux (Ubuntu 7.10) machine.   ;  Hmm, it's too late right now for me to do much testing, but addingwhile (SDL_PollEvent(&event) {}Appears to fix the problem (that is, after giving the display window the same "abuse", events are still captured); I haven't been able to reproduce the same error... yet! :-)I had a hunch that maybe the event queue was full for some reason, so I added that line to clear it of any and all pending events. Could this actually happen, or is this not doing at all what I thought it was? This has got me stumped, and it makes me uncomfortable leaving in a "fix" that I don't understand.   ;  You must handle all events. That's basically it. Even if you don't care about a certain event, you must still pull it off the queue. It won't magically disappear.   ;  That's what I figured. In that case, is there a quick way to clear the queue of all events? I can't seem to find such a function in the documentation, and I get the feeling that multiple calls to SDL_PollEvent may not be the fastest way to accomplish this.Thanks for the help!   ;  99% of SDL apps empty the whole queue, event by event, each time through the main game loop. It's not a performance problem. Few people bother with SDL_PeepEvents, and just loop through all events, using a switch statement or something to handle the ones they care about. You can either move to that approach, or just run SDL_PollEvent in a loop at the end to discard the unwanted ones, whatever suits you. There may also be some other function to empty the queue, but I've never needed it so I have no idea if it exists.   