Merge pull request #14 from realm/tg-end-read

End the read transaction after schema init
This commit is contained in:
Thomas Goyne 2015-12-09 16:25:56 -08:00
commit 324818f277
2 changed files with 8 additions and 0 deletions

View File

@ -177,6 +177,13 @@ SharedRealm Realm::get_shared_realm(Config config)
else {
realm->update_schema(std::move(target_schema), target_schema_version);
}
if (!m_config.read_only) {
// End the read transaction created to validation/update the
// schema to avoid pinning the version even if the user never
// actually reads data
invalidate();
}
}
}

View File

@ -90,6 +90,7 @@ namespace realm {
void commit_transaction();
void cancel_transaction();
bool is_in_transaction() const { return m_in_transaction; }
bool is_in_read_transaction() const { return !!m_group; }
bool refresh();
void set_auto_refresh(bool auto_refresh) { m_auto_refresh = auto_refresh; }