diff --git a/src/posix.cpp b/src/posix.cpp index 62d03c83a7..c8e887b105 100644 --- a/src/posix.cpp +++ b/src/posix.cpp @@ -581,6 +581,7 @@ class MySystem: public System { } virtual void dispose() { + assert(this, count == 0); pthread_mutex_destroy(&mutex); ::free(this); } diff --git a/src/windows.cpp b/src/windows.cpp index c06cf27f7d..59c819eb87 100644 --- a/src/windows.cpp +++ b/src/windows.cpp @@ -627,6 +627,7 @@ class MySystem: public System { } virtual void dispose() { + assert(this, count == 0); CloseHandle(mutex); ::free(this); }