From 0bae415718a9536ba19a3bcffb4f7bf727834dc3 Mon Sep 17 00:00:00 2001 From: kishikawa katsumi Date: Wed, 25 Nov 2015 00:39:13 +0900 Subject: [PATCH] Read-only Realm should be opened even in immutable directory Realm files in an app bundle should be opened if marked as read-only --- src/shared_realm.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/shared_realm.cpp b/src/shared_realm.cpp index 2ed7a7c3..91f4b46f 100644 --- a/src/shared_realm.cpp +++ b/src/shared_realm.cpp @@ -158,11 +158,15 @@ SharedRealm Realm::get_shared_realm(Config config) // FIXME - need to validate that schemas match realm->m_config.schema = std::make_unique(*existing->m_config.schema); - realm->m_notifier = existing->m_notifier; - realm->m_notifier->add_realm(realm.get()); + if (!realm->m_config.read_only) { + realm->m_notifier = existing->m_notifier; + realm->m_notifier->add_realm(realm.get()); + } } else { - realm->m_notifier = std::make_shared(realm.get()); + if (!realm->m_config.read_only) { + realm->m_notifier = std::make_shared(realm.get()); + } // otherwise get the schema from the group realm->m_config.schema = std::make_unique(ObjectStore::schema_from_group(realm->read_group()));