You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you provide instructions for how we can reproduce it? - yes
Crash log / stacktrace
E/REALM: /tmp/realm-java@2/realm/realm-library/src/main/cpp/realm-core/src/realm/object-store/impl/deep_change_checker.cpp:164: [realm-core-11.0.2] Unreachable code
<backtrace not supported on this platform>!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
Steps & Code to Reproduce
class MainActivity : AppCompatActivity(), CoroutineScope {
override val coroutineContext: CoroutineContext = SupervisorJob() + Dispatchers.IO
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initDb()
observeChanges()
launch {
(0..10).forEach {
saveEntities()
delay(300)
}
}
}
private fun initDb() {
Realm.init(applicationContext)
val directory =
File(applicationContext.filesDir.absolutePath + File.separator + "app_db")
val config = RealmConfiguration.Builder()
.directory(directory)
.deleteRealmIfMigrationNeeded()
.build()
Realm.setDefaultConfiguration(config)
}
private fun observeChanges() {
val realm = Realm.getDefaultInstance()
val listener = RealmChangeListener<RealmResults<TestEntity>> {
it.forEach { entity ->
Log.e("Test", "${entity.id} with innerCount: ${entity.items?.size}")
}
}
realm.where(TestEntity::class.java).findAllAsync().addChangeListener(listener)
}
private fun saveEntities() {
val realm = Realm.getDefaultInstance()
val from = Random.nextInt(30, 100)
val to = Random.nextInt(100, 10000)
val entities = (from..to).realmMap {
val innerEntities = (0..10).realmMap {
RealmAny.valueOf(
TestInnerEntity(
id = it.toLong()
)
)
}
TestEntity(
id = it.toLong(),
items = innerEntities
)
}
realm.executeTransaction {
it.copyToRealmOrUpdate(entities)
}
}
inline fun <T, R> Iterable<T>.realmMap(transform: (T) -> R): RealmList<R> {
return mapTo(RealmList(), transform)
}
}
open class TestEntity( @PrimaryKey var id: Long = 0, var items: RealmList<RealmAny>? = null ) : RealmObject()
open class TestInnerEntity( @PrimaryKey var id: Long = 0 ) : RealmObject()
The text was updated successfully, but these errors were encountered:
SDK and version
SDK : io.realm:realm-gradle-plugin
Version: 10.6.0
Observations
Crash log / stacktrace
Steps & Code to Reproduce
open class TestEntity( @PrimaryKey var id: Long = 0, var items: RealmList<RealmAny>? = null ) : RealmObject()
open class TestInnerEntity( @PrimaryKey var id: Long = 0 ) : RealmObject()
The text was updated successfully, but these errors were encountered: