Crash on Windows, because of shared_ptr reinterpret cast (#3999)

Summary:
For more details see #3998
Closes https://github.com/facebook/rocksdb/pull/3999

Differential Revision: D8458905

Pulled By: sagar0

fbshipit-source-id: d6e09182933253a08eaf81ac7cfe50ed3b6576c5
This commit is contained in:
Tomas Kolda 2018-06-17 20:54:22 -07:00 committed by Sagar Vemuri
parent 4e69cf0d20
commit 1e3fe96ffc
2 changed files with 2 additions and 2 deletions

View File

@ -3230,7 +3230,7 @@ Java_org_rocksdb_ColumnFamilyOptions_setCompactionFilterFactoryHandle(
JNIEnv* /*env*/, jobject /*jobj*/, jlong jopt_handle, JNIEnv* /*env*/, jobject /*jobj*/, jlong jopt_handle,
jlong jcompactionfilterfactory_handle) { jlong jcompactionfilterfactory_handle) {
auto* cff_factory = auto* cff_factory =
reinterpret_cast<std::shared_ptr<rocksdb::CompactionFilterFactory>*>( reinterpret_cast<std::shared_ptr<rocksdb::CompactionFilterFactoryJniCallback>*>(
jcompactionfilterfactory_handle); jcompactionfilterfactory_handle);
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jopt_handle) reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jopt_handle)
->compaction_filter_factory = *cff_factory; ->compaction_filter_factory = *cff_factory;

View File

@ -48,7 +48,7 @@ void Java_org_rocksdb_Transaction_setSnapshotOnNextOperation__JJ(
jlong jtxn_notifier_handle) { jlong jtxn_notifier_handle) {
auto* txn = reinterpret_cast<rocksdb::Transaction*>(jhandle); auto* txn = reinterpret_cast<rocksdb::Transaction*>(jhandle);
auto* txn_notifier = auto* txn_notifier =
reinterpret_cast<std::shared_ptr<rocksdb::TransactionNotifier>*>( reinterpret_cast<std::shared_ptr<rocksdb::TransactionNotifierJniCallback>*>(
jtxn_notifier_handle); jtxn_notifier_handle);
txn->SetSnapshotOnNextOperation(*txn_notifier); txn->SetSnapshotOnNextOperation(*txn_notifier);
} }