Weird SDL problem.
So I'm programming along, and all of a sudden, some of my data structures are getting corrupted. So I run it step by step in the debugger to find where things are going awry. I finally tracked it down to a call to SDL_PollEvent().
????
It doesn't scramble it, or crash the program, just writes the same corrupt data in each time. Any possible ideas of what this might be? I can't possibly be getting overlaping memory sections between restarts and everything eles, can I?
I'd post source code, but I don't know where to start. The functions are completely unrelated. I'm even still using the example SDL event handling and initialization code.
????
It doesn't scramble it, or crash the program, just writes the same corrupt data in each time. Any possible ideas of what this might be? I can't possibly be getting overlaping memory sections between restarts and everything eles, can I?
I'd post source code, but I don't know where to start. The functions are completely unrelated. I'm even still using the example SDL event handling and initialization code.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
The obvious thing to check is that the pointer you pass to SDL_PollEvent really is valid.
Yes, if nothing random has happened, memory will usually be allocated in exactly the same place each run.
Yes, if nothing random has happened, memory will usually be allocated in exactly the same place each run.
As well as what OSC already said, I found that most of my memory trashing errors were related to accidentally releasing CoreFoundation variables that I had no right to release! Try commenting out all irrelevant code before the SDL_PollEvent call, and see when it stops breaking!!
Good luck
- Iain
Good luck
- Iain
Well it works somewhat like this:
I've got some arrays with vertices and associated properties for a physics system. Specific elements of the arrays keep getting changed when I call SDL_PollEvents.
My function that handles events has a static variable defined in it, I just pass the address of that.
IBethune: My physics code has no dependencies outside of the standard C libraries, and everything else is SDL code. Most of that is still untouched from the template. I'm not quite sure what else I can disable and still have it work. Very frustrating when your code is only a hundred lines long, and you still have problems.
I've got some arrays with vertices and associated properties for a physics system. Specific elements of the arrays keep getting changed when I call SDL_PollEvents.
My function that handles events has a static variable defined in it, I just pass the address of that.
IBethune: My physics code has no dependencies outside of the standard C libraries, and everything else is SDL code. Most of that is still untouched from the template. I'm not quite sure what else I can disable and still have it work. Very frustrating when your code is only a hundred lines long, and you still have problems.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Weird problem in xcode SDL | skrew | 3 | 3,073 |
May 27, 2006 08:43 AM Last Post: Greywhind |
|
| Weird framerate problem | Jesse | 4 | 2,758 |
Sep 1, 2003 01:01 AM Last Post: Jesse |
|
| Weird OpenGL texture problem | DoG | 27 | 8,520 |
May 2, 2003 07:01 PM Last Post: henryj |
|
| Weird driver problem! | Dracir | 2 | 2,502 |
Jul 9, 2002 06:38 AM Last Post: kainsin |
|
| Weird GLUT problem | Dracir | 1 | 3,125 |
Jun 28, 2002 01:57 PM Last Post: OneSadCookie |
|

