浏览代码

Only need to keep around attachment loader if attachment->attachmentLoader is set.

NathanSweet 9 年之前
父节点
当前提交
f59e461230

+ 1 - 1
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);
 }

+ 0 - 1
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: {

+ 2 - 0
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);