Bak Posted March 21, 2008 Report Posted March 21, 2008 Well yeah, two days of straight debugging and I finally found this one. I think it surp!@#$%^&*es my previous favorite en!@#$%^&*led "pragma pack is the devil": http://forums.minegoboom.com/viewtopic.php?t=6508 anyways I was using an STL vector to store the ships which should be drawn on the screen. I then passed around pointers to these Ships to other modules so they could modify them as they see fit. The problem is, a vector reallocates memory as it grows... so when I had the pointer to the first element and then inserted another ship, the pointer to the first ship no longer pointed to valid memory. Rather than crashing, the program continued to run, until something else allocated some memory in the same spot (which happened to be an image that I wanted to draw), and then whenever I modified the ship I was also modifying the image. SDL then complained that images should be unlocked when drawing them to the screen (apparently the ships's y pixel location mapped to the locked field of the SDL_Surface structure)... so basically I had to work backwards from SDL's complaints to find the real problem. anyways yeah just rambling... that's about 20 hours of my life I'll never get back! Quote
Drake7707 Posted March 21, 2008 Report Posted March 21, 2008 ooh that's one nasty bug. I hate these bugs that seem random but are caused by some stupid stupid thing that's hidden like !@#$%^&* and involves LOTS of frustration and backtracking to find .... Quote
tcsoccerman Posted March 21, 2008 Report Posted March 21, 2008 the most i've taken on a bug is 3 hours. except if you add up all the time in my life i've been trying to get ASSS to compile. that's another story. Quote
»D1st0rt Posted March 23, 2008 Report Posted March 23, 2008 Good example of why you should always just write everything correctly the first time and skip all of this nonsense Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.