End the read transaction after schema init

This commit is contained in:
Thomas Goyne 2015-11-03 11:23:04 -08:00
parent f780342851
commit e53a534384
2 changed files with 8 additions and 0 deletions

View File

@ -171,6 +171,13 @@ SharedRealm Realm::get_shared_realm(Config config)
else { else {
realm->update_schema(std::move(target_schema), target_schema_version); 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

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