Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Access violation reading location 0x00000004.  (Read 2229 times)

0 Members and 1 Guest are viewing this topic.

replicant

  • Newbie
  • *
  • Posts: 18
    • View Profile
Access violation reading location 0x00000004.
« on: October 22, 2011, 04:15:45 am »
I'm getting an access violation and I can't figure out why, I have a class called Star which has a vector of sprites and creates an Animation, the Animation holds pointers to the sprites in Star. When I create one Star instance, everything works... but when I create a vector of Stars, I get an access violation. I'm pretty sure the pointer in the Animation is going invalid but when I create a vector of Animations and use them without the Star class, everything works... Anyway maybe my code will be better at explaining (Sorry for posting 6 files, hopefully someone has perfected the art of reading cringe inducing source code).

Animation.h
Animation.cpp
Star.h
Star.cpp
Background.h
Background.cpp

edit: I redesigned my animation class and things are a lot more simple now.

Animation.h
Animation.cpp
Star.h
Star.cpp

This is working well, only thing I'm not happy with is having to define the whole static LoadTexture function in Star.h.

 

anything