add release hook (#1690)

This commit is contained in:
江战 2020-06-03 19:27:02 +08:00 committed by GitHub
parent ba1cb75b07
commit 47873c041b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -61,6 +61,11 @@ public:
getInstance()->_free((void *) ptr, file, line);
}
template<typename T>
static void beforeFree(T *ptr) {
getInstance()->_beforeFree((void *) ptr);
}
static char *readFile(const String &path, int *length) {
return getInstance()->_readFile(path, length);
}
@ -83,6 +88,8 @@ public:
virtual char *_readFile(const String &path, int *length) = 0;
virtual void _beforeFree(void *ptr) {}
protected:
SpineExtension();

View File

@ -63,4 +63,5 @@ void SpineObject::operator delete(void *p) {
}
SpineObject::~SpineObject() {
SpineExtension::beforeFree(this);
}