I'm working on my first game in C++ and SDL. The game compiles and runs perfectly on both my boxes (Arch Linux and Windows XP). When two of my friends were to test the game, one of them (running Windows Vista) said his machine BSoD'd every time he ran the game.

Unless it's an SDL or Vista thing (which I highly doubt) I'm thinking it might be a pointer issue, but I'm not very good with pointers.

If anybody would take a quick look at the code I'd really appreciate it. (Any other suggestions/critique is very welcome as well. :) )

Thanks in advance for any help!

http://pastebin.com/JUKfdJHH

I'm not sure wether the BSoD still occurs, since I've made a lot of changes to the program since my friend tested it.
I haven't included "highscore.cpp" since this file didn't exist back then anyway.

If it happens, ask him to check the message that he gets when it BSOD's.. I've always been able to roughly fix BSOD problems from their message.

Under no circumstances a Windows box should BSOD because of a segmentation fault.

If it happens, ask him to check the message that he gets when it BSOD's.. I've always been able to roughly fix BSOD problems from their message.

Under no circumstances a Windows box should BSOD because of a segmentation fault.

EDIT: Another friend of mine with Windows Vista had his system frozen completely when he ran the game. There is clearly still an issue.

I didn't think it could either. Might be something with his computer instead. He just confirmed there was no problem with the new version.

But if anybody find any bug in the source code, I'd still love to hear from you. :)

I've GPL'd it and uploaded it here:
http://simonlarsen.host22.com/bitwarrior/

Have you joined for forums / mailing lists here?
http://www.libsdl.org/

Does a really simple program of just SDL_Init(); SDL_Quit(); also cause problems?
If it does, you have a really simple test case for a bug report.

Have you joined for forums / mailing lists here?
http://www.libsdl.org/

Does a really simple program of just SDL_Init(); SDL_Quit(); also cause problems?
If it does, you have a really simple test case for a bug report.

It's hard to test anything when I don't have access to a computer where the bug appears, and when my friends aren't that happy about BSOD's and system freezes but I'll see what I can do.

I just realized that I'm initiating everything in the code:

SDL_Init(SDL_INIT_EVERYTHING);

Could it be a driver issue? Like when trying to initiate joystick and cdrom stuff. I'll see if it disappears when it's only:

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);

It's a lot more likely that the BSOD is from some buggy driver than anything particular in your code (given that it works on other platforms already).

> SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
Definitely a good idea - only use what you need.

It's a lot more likely that the BSOD is from some buggy driver than anything particular in your code (given that it works on other platforms already).

> SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
Definitely a good idea - only use what you need.

This is really starting to piss me off. I changed it to:

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);

It works flawlessly for the guy who got the BSoD. But so does the older version where the BSoD appeared also now. Really strange.

The second guy who got the system freeze, was able to play the new version for some time, but when he switched window to Emesene to write back to me, his system froze again.

This is starting to get really frustrating now. I'm cannot find anybody else with this problem.

I'm compiling the Windows version with mingw using:

  • SDL-devel-1.2.14-mingw32
  • SDL_image-devel-1.2.10-VC
  • SDL_ttf-devel-2.0.9-VC8

and distributing the program with:

  • SDL-1.2.14-win32
  • SDL_image-1.2.10-win32
  • SDL_ttf-2.0.9-win32

I just stumbled upon this thread about a bug that sounds similar.
http://forums.libsdl.org/viewtopic.php?t=2549

But this seems to be a bug in SDL 1.2.11, and should be fixed in 1.2.12. Since I'm using 1.2.14 there shouldn't be a problem unless the bug has returned?

I might open a thread on the SDL forums instead.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.