From f88e48d1d3ebd81dbf9d17983ab916ced26ee410 Mon Sep 17 00:00:00 2001
From: Gareth Tribello <gareth.tribello@gmail.com>
Date: Sun, 1 Oct 2017 12:44:39 +0100
Subject: [PATCH] Added call to plumed_finalize in cython dealloc routine.

This should ensure that plumed_finalize is called when the python/cython
class is destroyed

Addresses #295
---
 python/cplumed.pxd | 1 +
 python/plumed.pyx  | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/cplumed.pxd b/python/cplumed.pxd
index e0f58c121..ab4be0635 100644
--- a/python/cplumed.pxd
+++ b/python/cplumed.pxd
@@ -27,3 +27,4 @@ cdef extern from "Plumed.h" :
          pass
      plumed plumed_create()
      void plumed_cmd(plumed p, const char*key, const void*val) except + 
+     void plumed_finalize(plumed p) except +
diff --git a/python/plumed.pyx b/python/plumed.pyx
index de2767157..f35d16bdd 100644
--- a/python/plumed.pyx
+++ b/python/plumed.pyx
@@ -35,8 +35,7 @@ cdef class Plumed:
          cdef int pres = 8
          cplumed.plumed_cmd(self.c_plumed, "setRealPrecision", <void*>&pres )  
      def __dealloc__(self): 
-         pass
-         #del self.c_plumed
+         cplumed.plumed_finalize(self.c_plumed)
 
      def cmd_ndarray_real(self, ckey, val):
          cdef double [:] abuffer = val.ravel()
-- 
GitLab