Merge pull request #2 from damucz/master

memory leaks
This commit is contained in:
Nathan Sweet 2013-02-24 10:09:47 -08:00
commit 0833be847e
6 changed files with 20 additions and 0 deletions

View File

@ -15,6 +15,7 @@ public:
float duration;
Animation (const std::vector<Timeline*> &timelines, float duration);
~Animation();
void apply (BaseSkeleton *skeleton, float time, bool loop);
};

View File

@ -71,6 +71,7 @@ public:
int *splits;
int *pads;
BaseAtlasRegion() : splits(0), pads(0) {}
virtual ~BaseAtlasRegion ();
};

View File

@ -31,6 +31,7 @@ public:
std::string name;
Skin (const std::string &name);
~Skin();
void addAttachment (int slotIndex, const std::string &name, Attachment *attachment);

View File

@ -18,6 +18,14 @@ Animation::Animation (const vector<Timeline*> &timelines, float duration) :
duration(duration) {
}
Animation::~Animation()
{
for (std::vector<Timeline*>::iterator iter = timelines.begin(); iter != timelines.end(); ++iter)
{
delete *iter;
}
}
void Animation::apply (BaseSkeleton *skeleton, float time, bool loop) {
if (!skeleton) throw std::invalid_argument("skeleton cannot be null.");

View File

@ -35,6 +35,8 @@ BaseSkeletonJson::BaseSkeletonJson (BaseAttachmentLoader *attachmentLoader) :
}
BaseSkeletonJson::~BaseSkeletonJson () {
if (attachmentLoader)
delete attachmentLoader;
}
SkeletonData* BaseSkeletonJson::readSkeletonData (std::ifstream &file) const {

View File

@ -8,6 +8,13 @@ Skin::Skin (const std::string &name) :
name(name) {
}
Skin::~Skin()
{
for (std::map<Key, Attachment*>::iterator iter = attachments.begin(); iter != attachments.end(); ++iter) {
delete iter->second;
}
}
void Skin::addAttachment (int slotIndex, const std::string &name, Attachment *attachment) {
Key key = {slotIndex, name};
attachments[key] = attachment;