diff --git a/spine-cpp/includes/spine/Animation.h b/spine-cpp/includes/spine/Animation.h index 45ae979dc..12eb2f523 100644 --- a/spine-cpp/includes/spine/Animation.h +++ b/spine-cpp/includes/spine/Animation.h @@ -15,6 +15,7 @@ public: float duration; Animation (const std::vector &timelines, float duration); + ~Animation(); void apply (BaseSkeleton *skeleton, float time, bool loop); }; diff --git a/spine-cpp/includes/spine/BaseAtlas.h b/spine-cpp/includes/spine/BaseAtlas.h index 7aba26972..0551d3c36 100644 --- a/spine-cpp/includes/spine/BaseAtlas.h +++ b/spine-cpp/includes/spine/BaseAtlas.h @@ -71,6 +71,7 @@ public: int *splits; int *pads; + BaseAtlasRegion() : splits(0), pads(0) {} virtual ~BaseAtlasRegion (); }; diff --git a/spine-cpp/includes/spine/Skin.h b/spine-cpp/includes/spine/Skin.h index 78fbcecfe..8d7e372fa 100644 --- a/spine-cpp/includes/spine/Skin.h +++ b/spine-cpp/includes/spine/Skin.h @@ -31,6 +31,7 @@ public: std::string name; Skin (const std::string &name); + ~Skin(); void addAttachment (int slotIndex, const std::string &name, Attachment *attachment); diff --git a/spine-cpp/src/spine/Animation.cpp b/spine-cpp/src/spine/Animation.cpp index 3ebd42fc2..20e52205d 100644 --- a/spine-cpp/src/spine/Animation.cpp +++ b/spine-cpp/src/spine/Animation.cpp @@ -18,6 +18,14 @@ Animation::Animation (const vector &timelines, float duration) : duration(duration) { } +Animation::~Animation() +{ + for (std::vector::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."); diff --git a/spine-cpp/src/spine/BaseSkeletonJson.cpp b/spine-cpp/src/spine/BaseSkeletonJson.cpp index 43ab778c0..49ae223b1 100644 --- a/spine-cpp/src/spine/BaseSkeletonJson.cpp +++ b/spine-cpp/src/spine/BaseSkeletonJson.cpp @@ -35,6 +35,8 @@ BaseSkeletonJson::BaseSkeletonJson (BaseAttachmentLoader *attachmentLoader) : } BaseSkeletonJson::~BaseSkeletonJson () { + if (attachmentLoader) + delete attachmentLoader; } SkeletonData* BaseSkeletonJson::readSkeletonData (std::ifstream &file) const { diff --git a/spine-cpp/src/spine/Skin.cpp b/spine-cpp/src/spine/Skin.cpp index 4d14465f5..12eeae0d6 100644 --- a/spine-cpp/src/spine/Skin.cpp +++ b/spine-cpp/src/spine/Skin.cpp @@ -8,6 +8,13 @@ Skin::Skin (const std::string &name) : name(name) { } +Skin::~Skin() +{ + for (std::map::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;