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:
[email protected]


Reply via email to