From f59e46123055b9b768495e6802ac894981cb6ac3 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sat, 2 Apr 2016 15:32:05 +0200 Subject: [PATCH] Only need to keep around attachment loader if attachment->attachmentLoader is set. --- spine-c/src/spine/Attachment.c | 2 +- spine-c/src/spine/SkeletonJson.c | 1 - spine-cocos2dx/3/src/spine/Cocos2dAttachmentLoader.c | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spine-c/src/spine/Attachment.c b/spine-c/src/spine/Attachment.c index e920f3219..20a57f0e5 100644 --- a/spine-c/src/spine/Attachment.c +++ b/spine-c/src/spine/Attachment.c @@ -48,7 +48,7 @@ void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType } void _spAttachment_deinit (spAttachment* self) { - spAttachmentLoader_disposeAttachment(self->attachmentLoader, self); + if (self->attachmentLoader) spAttachmentLoader_disposeAttachment(self->attachmentLoader, self); FREE(self->vtable); FREE(self->name); } diff --git a/spine-c/src/spine/SkeletonJson.c b/spine-c/src/spine/SkeletonJson.c index 061fcd6e3..684bb4dbf 100644 --- a/spine-c/src/spine/SkeletonJson.c +++ b/spine-c/src/spine/SkeletonJson.c @@ -631,7 +631,6 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha } continue; } - attachment->attachmentLoader = self->attachmentLoader; switch (attachment->type) { case SP_ATTACHMENT_REGION: { diff --git a/spine-cocos2dx/3/src/spine/Cocos2dAttachmentLoader.c b/spine-cocos2dx/3/src/spine/Cocos2dAttachmentLoader.c index 880614c85..7a8fb4b29 100644 --- a/spine-cocos2dx/3/src/spine/Cocos2dAttachmentLoader.c +++ b/spine-cocos2dx/3/src/spine/Cocos2dAttachmentLoader.c @@ -45,6 +45,8 @@ spAttachment* _Cocos2dAttachmentLoader_createAttachment (spAttachmentLoader* loa } void _Cocos2dAttachmentLoader_configureAttachment (spAttachmentLoader* loader, spAttachment* attachment) { + attachment->attachmentLoader = loader; + switch (attachment->type) { case SP_ATTACHMENT_REGION: { spRegionAttachment* regionAttachment = SUB_CAST(spRegionAttachment, attachment);