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

This commit is contained in:
NathanSweet 2016-04-02 15:32:05 +02:00
parent a133221acd
commit f59e461230
3 changed files with 3 additions and 2 deletions

View File

@ -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);
}

View File

@ -631,7 +631,6 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
}
continue;
}
attachment->attachmentLoader = self->attachmentLoader;
switch (attachment->type) {
case SP_ATTACHMENT_REGION: {

View File

@ -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);