[fbreader] Fixed incorrect use of atomic builtins

Which resulted in memory leaks
This commit is contained in:
Slava Monich 2015-09-13 13:14:13 +03:00
parent c243a75376
commit b70dd1bcf9

View file

@ -196,7 +196,7 @@ template<class T>
inline unsigned int shared_ptr_storage<T>::removeWeakReference() { inline unsigned int shared_ptr_storage<T>::removeWeakReference() {
#if FBREADER_USE_GNUC_SYNC_BUILTINS #if FBREADER_USE_GNUC_SYNC_BUILTINS
__sync_fetch_and_sub(&myWeakCounter, 1); __sync_fetch_and_sub(&myWeakCounter, 1);
return __sync_add_and_fetch(&myTotalCount, 1); return __sync_sub_and_fetch(&myTotalCount, 1);
#else #else
--myWeakCounter; --myWeakCounter;
return counter(); return counter();