You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/04/18 20:08:17 UTC

[GitHub] [geode-native] pivotal-jbarrett commented on a change in pull request #786: GEODE-9171: Fix leaked threads in .NET clients

pivotal-jbarrett commented on a change in pull request #786:
URL: https://github.com/apache/geode-native/pull/786#discussion_r615447354



##########
File path: clicache/src/Cache.cpp
##########
@@ -57,6 +56,20 @@ namespace Apache
         m_typeRegistry = gcnew Apache::Geode::Client::TypeRegistry(this);
       }
 
+      Cache::~Cache() { //Destructor - deterministic
+        if (_disposed) return;
+        //Clean-up managed resources
+        this->!Cache();
+        _disposed = true;
+        //GC.SuppressFinalize(this) is automatically added here
+        //Base destructor is automatically called too if needed
+      }
+
+      Cache::!Cache() { //Finalizer - non-deterministic when called by GC
+        //Clean-up unmanaged resources
+        m_nativeptr->get()->~Cache();

Review comment:
       You should never call a destructor directly. Delete the smart pointer it will deleted and destruct the object.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org