From d16319da40961c88ab7541c51ed0122e0c50da97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Tue, 24 May 2022 08:47:18 +0200 Subject: [PATCH] No need to round-trip logger through native code, now that it is a static member on Realm class --- lib/src/native/realm_core.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/src/native/realm_core.dart b/lib/src/native/realm_core.dart index a8e03aea6d..fd9182e286 100644 --- a/lib/src/native/realm_core.dart +++ b/lib/src/native/realm_core.dart @@ -1029,7 +1029,7 @@ class _RealmCore { static void _logCallback(Pointer userdata, int levelAsInt, Pointer message) { try { - final logger = userdata.toObject(isPersistent: true)!; + final logger = Realm.logger; final level = _LogLevel.values[levelAsInt].loggerLevel; // Don't do expensive utf8 to utf16 conversion unless we have to.. @@ -1048,12 +1048,11 @@ class _RealmCore { _realmLib.realm_sync_client_config_set_base_file_path(handle._pointer, configuration.baseFilePath.path.toUtf8Ptr(arena)); _realmLib.realm_sync_client_config_set_metadata_mode(handle._pointer, configuration.metadataPersistenceMode.index); - final logger = Realm.logger; - _realmLib.realm_sync_client_config_set_log_level(handle._pointer, _LogLevel.fromLevel(logger.level).index); + _realmLib.realm_sync_client_config_set_log_level(handle._pointer, _LogLevel.fromLevel(Realm.logger.level).index); _realmLib.realm_dart_sync_client_config_set_log_callback( handle._pointer, Pointer.fromFunction(_logCallback), - logger.toPersistentHandle(), + nullptr, _realmLib.addresses.realm_dart_delete_persistent_handle, scheduler.handle._pointer, );