From c4928553baeea75025811cd1dbcb35d006bda2ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simon=20D=C3=A9saulniers?= <rostydela@gmail.com>
Date: Fri, 15 Jan 2016 14:56:56 -0500
Subject: [PATCH] python: fix successive deref on cython object

---
 python/opendht.pyx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/opendht.pyx b/python/opendht.pyx
index aaad403b..4854de13 100644
--- a/python/opendht.pyx
+++ b/python/opendht.pyx
@@ -50,7 +50,6 @@ cdef inline void lookup_callback(cpp.vector[cpp.shared_ptr[cpp.IndexValue]]* val
             v._value = val
             vals.append(v)
         cbs['lookup'](vals, p.toString())
-    ref.Py_DECREF(cbs)
 
 cdef inline void shutdown_callback(void* user_data) with gil:
     cbs = <object>user_data
@@ -435,6 +434,7 @@ cdef class Pht(object):
         done_cb -- Called when the operation is completed.
         """
         cb_obj = {'done':done_cb}
+        ref.Py_INCREF(cb_obj)
         cdef cpp.IndexKey cppk
         for kk, v in key.items():
             cppk[bytes(kk, 'utf-8')] = cpp.Prefix(bytes(v))
-- 
GitLab