Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About rhollencamp

  • Rank
  1. rhollencamp

    SDL_FreeSurface crashes

    nevermind, I have a buffer overflow elsewhere that causes the memory corruption
  2. rhollencamp

    SDL_FreeSurface crashes

    I'm using SDL_TTF to render some text and then blit it onto the screen. Everything works fine except for the fact that I free the surface after I blit it; I get the following crash: *** glibc detected *** /home/wizzard/magnetmap/bin/Debug/magnetmap: malloc(): memory corruption (fast): 0x08117cf8 *** /lib/tls/i686/cmov/libc.so.6[0xb7c9c88f] /lib/tls/i686/cmov/libc.so.6(malloc+0x7f)[0xb7c9d83f] /usr/lib/libSDL-1.2.so.0(SDL_CreateRGBSurface+0xac)[0xb7edcebd] ...etc here's the code that causes it // ok now do the text if (strlen(text)) { SDL_Color color = {0, 0, 0}; SDL_Surface *renderedText = TTF_RenderText_Blended(font, text, color); if (!renderedText) { fprintf(stderr, "TTF_RenderText_Blended failed: '%s'\n", TTF_GetError()); exit(-1); } SDL_BlitSurface(renderedText, 0, screen, &rect); SDL_FreeSurface(renderedText); } if I comment out the SDL_FreeSurface everyting works fine, I can see the text, it just leaks memory. I have no idea what the problem is. Please help! wizzard
  3. rhollencamp

    Pointers and segfaults

    Lajnold: The source I pasted was an abridged version of the actual code; I gave you the header but not the implementation. Now that I know what the problem is, I just made it so AGE_Player isn't initialized until the engine is done initializing. Thanks guys for your help, I dono if I would have figured that one out on my own! Now that that's out of the way I can go rewrite all the stuff I deleted to try and debug what was going on :P Again thx for the help
  4. rhollencamp

    Pointers and segfaults

    I replaced the call to loadCharacter with cout << engine << endl; lo and behold, at that time the engine pointer == 0 :P at what point will the engine pointer be valid? after the constructor for AGE_Engine ?
  5. rhollencamp

    Pointers and segfaults

    The example I gave was like a proof of concept, not my exact code which I provided below: the actual class (not much in it, I was trying to write it but couldn't get around the segfault :P so I deleted everything till it got so basic and still not functional that I had to turn for help #pragma once class AGE_MD3Manager { public: AGE_MD3Manager() { bob = new int;} ~AGE_MD3Manager() { delete bob;} int loadCharacter(char *charName) {*bob = 5;} private: int *bob; }; here is where the class is defined. also note the definition of AGE_Player which calls the loadCharacter function. #pragma once #include "AGE_Texture.h" #include "AGE_BSP.h" #include "AGE_Player.h" #include "AGE_Camera.h" #include "AGE_MD3.h" struct sInfo { float gravity; float terminalVelocity; }; class AGE_Engine { public: AGE_Engine(); ~AGE_Engine(); // transfers control to AGE int go(); // when things go wrong inline void b0rked() {delete this;} // processes events bool pump(); // accessors inline AGE_Texture *getTexManager() {return &texHandler;} inline AGE_MD3Manager *getMD3Manager() {return &md3Handler;}; inline AGE_Camera *getCamera() {return &cam;} inline AGE_BSP *getBSP() {return &bsp;} sInfo info; private: // initialization functions bool initSDLGL(); // other stuff AGE_Texture texHandler; AGE_MD3Manager md3Handler; AGE_BSP bsp; AGE_Player player; AGE_Camera cam; }; extern AGE_Engine *engine; and the function call is in the constructor of AGE_Player AGE_Player::AGE_Player() { acceleration = position = cVectorf(0, 0, 0); charHandle = engine->getMD3Manager()->loadCharacter("sarge"); } I think this is all the relivant source...if you need anything else let me know.
  6. This one really has me stumped; I have the following class class cClass { public: cClass() { bob = new int;} ~cClass() { delete bob;} int WTF(char *charName) {*bob = 5; return 0;} private: int *bob; }; which will segfault whenever WTF is called. I really cannot understand why...please help!
  7. In the OGL game that I am writing, something weird is happening: when I use the debug build everything is fine, but when I do a release build most of the walls get culled. See pic at http://pages.pgsit.org/2004/robertho/wtf.JPG. I don't know where to even start to debug this; could someone give me some tips? Should I post my source?
  8. Does anybody know what happened to Lonerunner's Opengl website? His URL was http://lonerunner.cfxweb.net/ but that doesn't work anymore =( I'm looking for his MD3Load source...does anybody know if he has a new website or if anybody mirrored the source code? I looked around on google but couldn't find it. Any help would be appriciated Robert Hollencamp
  • 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!