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) */