From 6ad545cea041e4ea1fe68f34ced474ab0d392e55 Mon Sep 17 00:00:00 2001
From: hofmockel <dreagonfly@gmx.de>
Date: Thu, 23 Jan 2014 08:10:51 +0100
Subject: [PATCH] Fix possible crash if snapshot and DB take part in cyclic
 gargabe collection

The cyclic garbage collector may choose this snappshot object to break the
cycle. In that case tp_clear will remove the reference to self.db.
So if __dealloc__ of the snapshot is called, self.db is not valid anymore
---
 rocksdb/_rocksdb.pyx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx
index dfd72db..284e7f9 100644
--- a/rocksdb/_rocksdb.pyx
+++ b/rocksdb/_rocksdb.pyx
@@ -1309,6 +1309,7 @@ cdef class DB(object):
         def __get__(self):
             return self.opts
 
+@cython.no_gc_clear
 @cython.internal
 cdef class Snapshot(object):
     cdef const snapshot.Snapshot* ptr
-- 
GitLab