Skip to content

Commit 18e5d20

Browse files
committed
Merge tag 'v14.10.4' into next-major
2 parents 0e533a7 + 44db2a2 commit 18e5d20

File tree

6 files changed

+62
-12
lines changed

6 files changed

+62
-12
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@
2121

2222
----------------------------------------------
2323

24+
# 14.10.4 Release notes
25+
26+
### Enhancements
27+
* None.
28+
29+
### Fixed
30+
* When a public name is defined on a property, calling `realm::Results::sort()` or `realm::Results::distinct()` with the internal name could throw an error like `Cannot sort on key path 'NAME': property 'PersonObject.NAME' does not exist`. ([realm/realm-js#6779](https://github.com/realm/realm-js/issues/6779), since v12.12.0)
31+
32+
### Breaking changes
33+
* None.
34+
35+
### Compatibility
36+
* Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.
37+
38+
-----------
39+
40+
### Internals
41+
* Fix a thread sanitizer failure in the "unregister connection change listener during callback" test ([PR #7871](https://github.com/realm/realm-core/pull/7871)).
42+
43+
----------------------------------------------
44+
2445
# 14.10.3 Release notes
2546

2647
### Enhancements

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import PackageDescription
44
import Foundation
55

6-
let versionStr = "14.10.3"
6+
let versionStr = "14.10.4"
77
let versionPieces = versionStr.split(separator: "-")
88
let versionCompontents = versionPieces[0].split(separator: ".")
99
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""

dependencies.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PACKAGE_NAME: realm-core
2-
VERSION: 14.10.3
2+
VERSION: 14.10.4
33
OPENSSL_VERSION: 3.2.0
44
ZLIB_VERSION: 1.2.13
55
# https://github.com/10gen/baas/commits
6-
# 9d1b4d6 is 2024 May 8
7-
BAAS_VERSION: 9d1b4d628babadfb606ebcadb93b1e5cae3c9565
6+
# 2f308db is 2024 July 10
7+
BAAS_VERSION: 2f308db6f65333728a101d1fecbb792f9659a5ce

src/realm/object-store/results.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,9 @@ static std::vector<ExtendedColumnKey> parse_keypath(StringData keypath, Schema c
871871
begin = sep + (sep != end);
872872

873873
auto prop = object_schema->property_for_public_name(key);
874+
if (!prop) {
875+
prop = object_schema->property_for_name(key);
876+
}
874877
check(prop, "property '%1.%2' does not exist", object_schema->name, key);
875878
if (is_dictionary(prop->type)) {
876879
check(index.length(), "missing dictionary key");

test/object-store/results.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4983,7 +4983,7 @@ TEST_CASE("results: public name declared", "[results]") {
49834983
realm->commit_transaction();
49844984
Results r(realm, table);
49854985

4986-
SECTION("sorted") {
4986+
SECTION("sorted by public_name") {
49874987
auto sorted = r.sort({{"public_value", true}});
49884988
REQUIRE(sorted.limit(0).size() == 0);
49894989
REQUIRE_ORDER(sorted.limit(1), 2);
@@ -4992,7 +4992,16 @@ TEST_CASE("results: public name declared", "[results]") {
49924992
REQUIRE_ORDER(sorted.limit(100), 2, 6, 3, 7, 0, 4, 1, 5);
49934993
}
49944994

4995-
SECTION("distinct") {
4995+
SECTION("sorted by name") {
4996+
auto sorted = r.sort({{"value", true}});
4997+
REQUIRE(sorted.limit(0).size() == 0);
4998+
REQUIRE_ORDER(sorted.limit(1), 2);
4999+
REQUIRE_ORDER(sorted.limit(2), 2, 6);
5000+
REQUIRE_ORDER(sorted.limit(8), 2, 6, 3, 7, 0, 4, 1, 5);
5001+
REQUIRE_ORDER(sorted.limit(100), 2, 6, 3, 7, 0, 4, 1, 5);
5002+
}
5003+
5004+
SECTION("distinct by public_name") {
49965005
auto sorted = r.distinct({"public_value"});
49975006
REQUIRE(sorted.limit(0).size() == 0);
49985007
REQUIRE_ORDER(sorted.limit(1), 0);
@@ -5005,6 +5014,20 @@ TEST_CASE("results: public name declared", "[results]") {
50055014
REQUIRE_ORDER(sorted.limit(2), 2, 3);
50065015
REQUIRE_ORDER(sorted.limit(8), 2, 3, 0, 1);
50075016
}
5017+
5018+
SECTION("distinct by name") {
5019+
auto sorted = r.distinct({"value"});
5020+
REQUIRE(sorted.limit(0).size() == 0);
5021+
REQUIRE_ORDER(sorted.limit(1), 0);
5022+
REQUIRE_ORDER(sorted.limit(2), 0, 1);
5023+
REQUIRE_ORDER(sorted.limit(8), 0, 1, 2, 3);
5024+
5025+
sorted = r.sort({{"value", true}}).distinct({"value"});
5026+
REQUIRE(sorted.limit(0).size() == 0);
5027+
REQUIRE_ORDER(sorted.limit(1), 2);
5028+
REQUIRE_ORDER(sorted.limit(2), 2, 3);
5029+
REQUIRE_ORDER(sorted.limit(8), 2, 3, 0, 1);
5030+
}
50085031
}
50095032

50105033
TEST_CASE("notifications: objects with PK recreated", "[results]") {

test/object-store/sync/session/connection_change_notifications.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ TEST_CASE("sync: Connection state changes", "[sync][session][connection change]"
6969

7070
auto token1 = session->register_connection_change_callback(
7171
[&](SyncSession::ConnectionState, SyncSession::ConnectionState) {
72-
listener1_call_cnt = listener1_call_cnt + 1;
72+
++listener1_call_cnt;
7373
});
7474
session->unregister_connection_change_callback(token1);
7575
// One call may have been in progress when unregistered
@@ -87,16 +87,18 @@ TEST_CASE("sync: Connection state changes", "[sync][session][connection change]"
8787
}
8888

8989
SECTION("unregister connection change listener during callback") {
90-
uint64_t token1;
91-
std::atomic<int> listener1_call_cnt(0);
92-
std::atomic<bool> listener2_called(false);
90+
int listener1_call_cnt = 0;
9391
auto session = sync_session(
9492
user, "/connection-state-changes-3", [](auto, auto) {}, SyncSessionStopPolicy::AfterChangesUploaded);
95-
token1 = session->register_connection_change_callback(
93+
std::mutex mutex;
94+
std::unique_lock lock(mutex);
95+
uint64_t token1 = session->register_connection_change_callback(
9696
[&](SyncSession::ConnectionState, SyncSession::ConnectionState) {
97-
listener1_call_cnt = listener1_call_cnt + 1;
97+
std::lock_guard lock(mutex);
98+
++listener1_call_cnt;
9899
session->unregister_connection_change_callback(token1);
99100
});
101+
lock.unlock();
100102

101103
EventLoop::main().run_until([&] {
102104
return sessions_are_active(*session);
@@ -105,6 +107,7 @@ TEST_CASE("sync: Connection state changes", "[sync][session][connection change]"
105107
return sessions_are_connected(*session);
106108
});
107109

110+
bool listener2_called = false;
108111
session->register_connection_change_callback([&](SyncSession::ConnectionState, SyncSession::ConnectionState) {
109112
listener2_called = true;
110113
});

0 commit comments

Comments
 (0)