Jump to content
  • Advertisement
Sign in to follow this  
adam17

finding access violations

This topic is 4838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
You mean like when the game crashes?

Yes. run the game through the debugger. the debugger will break on the line that caused the violation and you can take a look at all the local variables and see what went wrong.

-me

Share this post


Link to post
Share on other sites
You mean breaking when an access violation occurs? If you go to your debugger options for exceptions there should be a setting for breaking into the debugger when a C0000005 occurs.

Share this post


Link to post
Share on other sites
ok i have the debugger stopping at the access violation but it gives me 2 errors:

First-chance exception at 0x00000000 in Lucid Engine 0.1a.exe: 0xC0000005: Access violation reading location 0x00000000.

and...

Unhandled exception at 0x00000000 in Lucid Engine 0.1a.exe: 0xC0000005: Access violation reading location 0x00000000.


any ideas? 0x00000000 doesnt look too good

Share this post


Link to post
Share on other sites
It just sounds like you derefrenced a null pointer. Maybe you tried to use a pointer you deleted and nulled. Maybe you didn't check for an error condition somewhere. That's really all I can say with just the error you've got.

Share this post


Link to post
Share on other sites
Why not use an exception handling...you have to write more code and conditions but you can easily trace the evil command.
A suggestion: if you really need to use pointers check always if they are valid!

Share this post


Link to post
Share on other sites
ok ive narrowed it down to a function i wrote inside of a base class for some GLSL shaders. does anyone see any problems with the following lines of code?


const char* v = ReadShader(vert_file);
vert = glCreateShader(GL_VERTEX_SHADER_ARB);
glShaderSource(vert, 1, (const char**)&v, NULL);
glCompileShader(vert);
glAttachShader(prog, vert);
delete[] v;

Share this post


Link to post
Share on other sites
Quote:
Original post by adam17
ok ive narrowed it down to a function i wrote inside of a base class for some GLSL shaders. does anyone see any problems with the following lines of code?


const char* v = ReadShader(vert_file);
vert = glCreateShader(GL_VERTEX_SHADER_ARB);
glShaderSource(vert, 1, (const char**)&v, NULL);
glCompileShader(vert);
glAttachShader(prog, vert);
delete[] v;


Can you use ASSERT() on either "v" or "vert" after the assignments? Perhaps one or either are NULL.


Share this post


Link to post
Share on other sites
Quote:
Original post by blizzard999
Are you sure v is not NULL when you pass it to glShaderSource()?


i cant beleive i didnt think about that. thanks alot!

now i have to figure out why my ReadShader function isnt reading properly

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!