Skip to content

Commit

Permalink
Update to core 11.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Aug 4, 2021
1 parent 84179b4 commit 41247ef
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 71 deletions.
34 changes: 25 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,38 @@ x.y.z Release notes (yyyy-MM-dd)
* `Object.observe` and `RealmCollection.observe` now include an optional `keyPaths` parameter which filters change notifications to those only occurring on the provided key path or key paths. See method documentation for extended detail on filtering behavior.
* `ObservedResults<ResultsType>` now includes an optional `keyPaths` parameter which filters change notifications to those only occurring on the provided key path or key paths. ex) `@ObservedResults(MyObject.self, keyPaths: ["myList.property"])`
* Add two new property wrappers for opening a Realm asynchronously in a
* Add two new property wrappers for opening a Realm asynchronously in a
SwiftUI View:
- `AsyncOpen` is a property wrapper that initiates Realm.asyncOpen
- `AsyncOpen` is a property wrapper that initiates Realm.asyncOpen
for the current user, notifying the view when there is a change in Realm asyncOpen state.
- `AutoOpen` behaves similarly to `AsyncOpen`, but in the case of no internet
connection this will return an opened realm.
* Add `EnvironmentValues.partitionValue`. This value can be injected into any view using one of
connection this will return an opened realm.
* Add `EnvironmentValues.partitionValue`. This value can be injected into any view using one of
our new property wrappers `AsyncOpen` and `AutoOpen`:
`MyView().environment(\.partitionValue, "partitionValue")`.
`MyView().environment(\.partitionValue, "partitionValue")`.
* Shift more of the work done when first initializing a collection notifier to the background worker thread rather than doing it on the main thread.

### Fixed
* Fix `configuration(partitionValue: AnyBSON)` will set always a nil partition value
* `configuration(partitionValue: AnyBSON)` would always set a nil partition value
for the user sync configuration.
* Fix decoding a `@Persisted` property will incorrectly throw a `DecodingError.keyNotFound`
* Decoding a `@Persisted` property would incorrectly throw a `DecodingError.keyNotFound`
for an optional property if the key is missing.
([Cocoa #7358](https://github.com/realm/realm-cocoa/issues/7358), since v10.10.0)
* Fixed a symlink which prevented Realm from building on case sensitive file systems.
* Fixed a symlink which prevented Realm from building on case sensitive file systems.
([#7344](https://github.com/realm/realm-cocoa/issues/7344), since v10.8.0)
* Removing a change callback from a Results would sometimes block the calling
thread while the query for that Results was running on the background worker
thread (since v10.11.0).
* Object observers did not handle the object being deleted properly, which
could result in assertion failures mentioning "m_table" in ObjectNotifier
([Core #4824](https://github.com/realm/realm-core/issues/4824), since v10.11.0).
* Fixed a crash when delivering notifications over a nested hierarchy of lists
of Mixed that contain links. ([Core #4803](https://github.com/realm/realm-core/issues/4803), since v10.8.0)
* Fixed a crash when an object which is linked to by a Mixed is deleted via
sync. ([Core #4828](https://github.com/realm/realm-core/pull/4828), since v10.8.0)
* Fixed a rare crash when setting a mixed link for the first time which would
trigger if the link was to the same table and adding the backlink column
caused a BPNode split. ([Core #4828](https://github.com/realm/realm-core/pull/4828), since v10.8.0)

<!-- ### Breaking Changes - ONLY INCLUDE FOR NEW MAJOR version -->

Expand All @@ -29,10 +44,11 @@ x.y.z Release notes (yyyy-MM-dd)
* APIs are backwards compatible with all previous releases in the 10.x.y series.
* Carthage release for Swift is built with Xcode 12.5.1.
* CocoaPods: 1.10 or later.
* Xcode: 12.2-13.0 beta 3.
* Xcode: 12.2-13.0 beta 4. On iOS Xcode 13 beta 2 is the latest supported
version due to betas 3 and 4 having a broken Combine.framework.

### Internal
* Upgraded realm-core from ? to ?
* Upgraded realm-core from v11.1.1 to v11.2.0

10.11.0 Release notes (2021-07-22)
=============================================================
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription
import Foundation

let coreVersionStr = "11.1.1"
let coreVersionStr = "11.2.0"
let cocoaVersionStr = "10.11.0"

let coreVersionPieces = coreVersionStr.split(separator: ".")
Expand Down
23 changes: 5 additions & 18 deletions Realm/RLMManagedDictionary.mm
Original file line number Diff line number Diff line change
Expand Up @@ -368,29 +368,16 @@ - (void)removeObjectsForKeys:(NSArray *)keyArray {
RLMAccessorContext context(*_objectInfo);
changeDictionary(self, [&] {
for (id key in keyArray) {
try {
_backingCollection.erase(context.unbox<realm::StringData>(key));
}
catch (realm::KeyNotFound const&) {
continue;
}
_backingCollection.try_erase(context.unbox<realm::StringData>(key));
}
});
}

- (void)removeObjectForKey:(id)key {
try {
changeDictionary(self, ^{
RLMAccessorContext context(*_objectInfo);
_backingCollection.erase(context.unbox<realm::StringData>(key));
});
}
catch (realm::KeyNotFound const&) {
return;
}
catch (...) {
throwError(nil, nil);
}
changeDictionary(self, ^{
RLMAccessorContext context(*_objectInfo);
_backingCollection.try_erase(context.unbox<realm::StringData>(key));
});
}

- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block {
Expand Down
63 changes: 21 additions & 42 deletions Realm/RLMRealm.mm
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ REALM_NOINLINE void RLMRealmTranslateException(NSError **error) {
catch (SchemaMismatchException const& ex) {
RLMSetErrorOrThrow(RLMMakeError(RLMErrorSchemaMismatch, ex), error);
}
catch (DeleteOnOpenRealmException const& ex) {
RLMSetErrorOrThrow(RLMMakeError(RLMErrorAlreadyOpen, ex), error);
}
catch (std::system_error const& ex) {
RLMSetErrorOrThrow(RLMMakeError(ex), error);
}
Expand All @@ -358,16 +361,6 @@ REALM_NOINLINE void RLMRealmTranslateException(NSError **error) {
}
}

REALM_NOINLINE static void translateSharedGroupOpenException(NSError **error) {
try {
throw;
}
catch (...) {
RLMRealmTranslateException(error);
}
}


+ (instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error {
return [self realmWithConfiguration:configuration queue:nil error:error];
}
Expand Down Expand Up @@ -450,7 +443,7 @@ + (instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration
realm->_realm = Realm::get_shared_realm(config);
}
catch (...) {
translateSharedGroupOpenException(error);
RLMRealmTranslateException(error);
return nil;
}

Expand Down Expand Up @@ -892,7 +885,7 @@ + (uint64_t)schemaVersionAtURL:(NSURL *)fileURL encryptionKey:(NSData *)key erro
return version;
}
catch (...) {
translateSharedGroupOpenException(error);
RLMRealmTranslateException(error);
return RLMNotVersioned;
}
}
Expand Down Expand Up @@ -926,11 +919,9 @@ - (BOOL)writeCopyToURL:(NSURL *)fileURL encryptionKey:(NSData *)key error:(NSErr
return YES;
}
catch (...) {
__autoreleasing NSError *dummyError;
if (!error) {
error = &dummyError;
if (error) {
RLMRealmTranslateException(error);
}
RLMRealmTranslateException(error);
return NO;
}

Expand All @@ -942,37 +933,25 @@ + (BOOL)fileExistsForConfiguration:(RLMRealmConfiguration *)config {
}

+ (BOOL)deleteFilesForConfiguration:(RLMRealmConfiguration *)config error:(NSError **)error {
auto& path = config.config.path;
bool anyDeleted = false;
NSError *localError;
bool didCall = DB::call_with_lock(path, [&](auto const& path) {
NSURL *url = [NSURL fileURLWithPath:@(path.c_str())];
NSFileManager *fm = NSFileManager.defaultManager;

anyDeleted = [fm removeItemAtURL:url error:&localError];
if (localError && localError.code != NSFileNoSuchFileError) {
return;
}

[fm removeItemAtURL:[url URLByAppendingPathExtension:@"management"] error:&localError];
if (localError && localError.code != NSFileNoSuchFileError) {
return;
bool didDeleteAny = false;
try {
realm::Realm::delete_files(config.config.path, &didDeleteAny);
return didDeleteAny;
}
catch (realm::util::File::PermissionDenied const& e) {
if (error) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteNoPermissionError
userInfo:@{NSLocalizedDescriptionKey: @(e.what()),
NSFilePathErrorKey: @(e.get_path().c_str())}];
}

[fm removeItemAtURL:[url URLByAppendingPathExtension:@"note"] error:&localError];
});
if (error && localError && localError.code != NSFileNoSuchFileError) {
*error = localError;
return didDeleteAny;
}
else if (!didCall) {
catch (...) {
if (error) {
NSString *msg = [NSString stringWithFormat:@"Realm file at path %s cannot be deleted because it is currently opened.", path.c_str()];
*error = [NSError errorWithDomain:RLMErrorDomain
code:RLMErrorAlreadyOpen
userInfo:@{NSLocalizedDescriptionKey: msg}];
RLMRealmTranslateException(error);
}
return didDeleteAny;
}
return anyDeleted;
}

- (BOOL)isFrozen {
Expand Down
2 changes: 1 addition & 1 deletion dependencies.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION=10.11.0
REALM_CORE_VERSION=11.1.1
REALM_CORE_VERSION=11.2.0
STITCH_VERSION=45504b796f90c58ab56a3d4c34f1031f23d7e199

0 comments on commit 41247ef

Please sign in to comment.