Fix for failing nested transaction test
This commit is contained in:
parent
a0424c6600
commit
fc49470b3c
|
@ -459,17 +459,17 @@ void Realm<T>::write(ContextType ctx, ObjectType this_object, size_t argc, const
|
||||||
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
SharedRealm realm = *get_internal<T, RealmClass<T>>(this_object);
|
||||||
FunctionType callback = Value::validated_to_function(ctx, arguments[0]);
|
FunctionType callback = Value::validated_to_function(ctx, arguments[0]);
|
||||||
|
|
||||||
try {
|
|
||||||
realm->begin_transaction();
|
realm->begin_transaction();
|
||||||
|
|
||||||
|
try {
|
||||||
Function<T>::call(ctx, callback, this_object, 0, nullptr);
|
Function<T>::call(ctx, callback, this_object, 0, nullptr);
|
||||||
realm->commit_transaction();
|
|
||||||
}
|
}
|
||||||
catch (std::exception &exp) {
|
catch (std::exception &e) {
|
||||||
if (realm->is_in_transaction()) {
|
|
||||||
realm->cancel_transaction();
|
realm->cancel_transaction();
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
throw;
|
|
||||||
}
|
realm->commit_transaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
Loading…
Reference in New Issue