Java Bindings: prevent segfault from double delete

Give BackupableDB sole responsibility of the native
object to prevent RocksDB from also trying to delete
it.
This commit is contained in:
Bob Potter
2014-05-20 18:52:27 -05:00
parent b2cf95fe38
commit 5fe176d8f6
2 changed files with 16 additions and 0 deletions

View File

@@ -31,6 +31,10 @@ public class BackupableDB extends RocksDB {
BackupableDB bdb = new BackupableDB(RocksDB.open(opt, db_path));
bdb.open(bdb.db_.nativeHandle_, bopt.nativeHandle_);
// Prevent the RocksDB object from attempting to delete
// the underly C++ DB object.
bdb.db_.disOwnNativeObject();
return bdb;
}