Fix memory release

develop
kaetemi 4 years ago
parent b220dac7b3
commit f50b59702e

@ -46,6 +46,7 @@ class CStringManagerClient
public: public:
// Singleton pattern implementation // Singleton pattern implementation
static CStringManagerClient *instance(); static CStringManagerClient *instance();
static bool hasInstance() { return _Instance; }
static void release(bool mustReleaseStaticArrays); static void release(bool mustReleaseStaticArrays);
/** Prepare the string manager to use a persistent string cache. /** Prepare the string manager to use a persistent string cache.
@ -388,6 +389,7 @@ public:
virtual ~IStringWaiterRemover() virtual ~IStringWaiterRemover()
{ {
// signal the string manager that this waiter is destroyed // signal the string manager that this waiter is destroyed
if (CStringManagerClient::hasInstance())
CStringManagerClient::instance()->removeStringWaiter(this); CStringManagerClient::instance()->removeStringWaiter(this);
} }
}; };
@ -406,6 +408,7 @@ public:
virtual ~IStringWaitCallback() virtual ~IStringWaitCallback()
{ {
// signal the string manager that this waiter is destroyed // signal the string manager that this waiter is destroyed
if (CStringManagerClient::hasInstance())
CStringManagerClient::instance()->removeStringWaiter(this); CStringManagerClient::instance()->removeStringWaiter(this);
} }

Loading…
Cancel
Save