From 85286b88078385fa9862bb1e3207726a8b87e274 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Mon, 16 Nov 2015 11:16:09 -0800 Subject: [PATCH] block refresh until the last context has finished execution --- shared_realm.cpp | 6 ++++-- shared_realm.hpp | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/shared_realm.cpp b/shared_realm.cpp index 09b4d188..d95b8bd2 100644 --- a/shared_realm.cpp +++ b/shared_realm.cpp @@ -287,8 +287,6 @@ void Realm::cancel_transaction() void Realm::invalidate() { verify_thread(); - check_read_write(this); - if (m_in_transaction) { cancel_transaction(); } @@ -384,6 +382,10 @@ void Realm::close() m_notifier->remove_realm(this); } + if (m_group) { + m_shared_group->end_read(); + } + m_group = nullptr; m_shared_group = nullptr; m_history = nullptr; diff --git a/shared_realm.hpp b/shared_realm.hpp index 81b14bf7..09685128 100644 --- a/shared_realm.hpp +++ b/shared_realm.hpp @@ -197,6 +197,12 @@ namespace realm { public: UnitializedRealmException(std::string message) : std::runtime_error(message) {} }; + + class ClosedRealmException : public std::runtime_error + { + public: + ClosedRealmException(std::string message) : std::runtime_error(message) {} + }; } #endif /* defined(REALM_REALM_HPP) */