From 253a572ca741bb88d4fc33b0a8a4d76a4487b1df Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Wed, 16 Dec 2015 13:04:43 -0800 Subject: [PATCH] Fix crash caused by accessing invalid ObjectSchema These references would eventually become invalid. The quickest fix is for them to no longer be references. The longer-term fix might be to only store the object type and dynamically retrieve the ObjectSchema only when necessary. Fixes #181 --- list.hpp | 2 +- object_accessor.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/list.hpp b/list.hpp index fdde4c62..934c56ce 100644 --- a/list.hpp +++ b/list.hpp @@ -27,7 +27,7 @@ namespace realm { public: List(SharedRealm &r, const ObjectSchema &s, LinkViewRef l) : m_realm(r), object_schema(s), m_link_view(l) {} - const ObjectSchema &object_schema; + const ObjectSchema object_schema; SharedRealm realm() { return m_realm; } size_t size(); diff --git a/object_accessor.hpp b/object_accessor.hpp index ffa3edb6..2f52619c 100644 --- a/object_accessor.hpp +++ b/object_accessor.hpp @@ -27,7 +27,7 @@ namespace realm { template static inline Object create(ContextType ctx, SharedRealm realm, ObjectSchema &object_schema, ValueType value, bool try_update); - const ObjectSchema &object_schema; + const ObjectSchema object_schema; SharedRealm realm() { return m_realm; } Row row() { return m_row; }