Skip to content

Commit

Permalink
fix crash in test with Swift 3.1
Browse files Browse the repository at this point in the history
I'm not sure why this fixes the crash.

Traceback (most recent call last):
  File "/Users/jp/Library/Application Support/Realm/rlm_lldb.py", line 226, in RLMResults_SummaryProvider
    if not is_results_evaluated(obj):
  File "/Users/jp/Library/Application Support/Realm/rlm_lldb.py", line 213, in is_results_evaluated
    mode_query_value = next(m for m in mode_type.enum_members if m.name == 'Query').GetValueAsUnsigned()
StopIteration
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00007fffcebe8ae6 libobjc.A.dylib`lookUpImpOrForward + 79
    frame #1: 0x00007fffcebe85d4 libobjc.A.dylib`_objc_msgSend_uncached + 68
    frame #2: Realm`-[RLMResults deleteObjectsFromRealm]::$_14::operator(this=0x00007fff5fbfb8c8)() const at RLMResults.mm:424
    frame #3: Realm`auto translateErrors<-[RLMResults deleteObjectsFromRealm]::$_14>(f=0x00007fff5fbfb8c8, aggregateMethod=0x0000000000000000) at RLMResults.mm:108
    frame #4: Realm`::-[RLMResults deleteObjectsFromRealm](self=0x000000010230bb10, _cmd="deleteObjectsFromRealm") at RLMResults.mm:417
    frame #5: Realm`::-[RLMRealm deleteObjects:](self=0x00006080000a2ca0, _cmd="deleteObjects:", array=(None[0])) at RLMRealm.mm:623
    frame #6: RealmSwift`Realm.delete<A where ...> (objects=<unavailable>, self=0x0000608000030040) -> () at Realm.swift:404
    frame #7: RealmSwift Tests`RealmTests.(realm=0x0000608000030040) -> ()).(closure #1) at RealmTests.swift:435
    frame #8: RealmSwift`Realm.write(block=0x0000000104a35270 RealmSwift Tests`RealmSwift_Tests.RealmTests.(testDeleteResults () -> ()).(closure #1) at RealmTests.swift:430, self=0x0000608000030040, $error=Error @ 0x00007fff5fbfbe40) throws -> ()) throws -> () at Realm.swift:124
    frame #9: RealmSwift Tests`RealmTests.testDeleteResults(self=0x0000608000089fb0) -> () at RealmTests.swift:437
    frame #10: RealmSwift Tests`@objc RealmTests.testDeleteResults() -> () at RealmTests.swift:0
    frame #11: 0x00007fffb9f733ec CoreFoundation`__invoking___ + 140
    frame #12: 0x00007fffb9f73271 CoreFoundation`-[NSInvocation invoke] + 289
    frame #13: 0x00000001000c847c XCTest`__24-[XCTestCase invokeTest]_block_invoke.234 + 50
    frame #14: 0x000000010010dcd6 XCTest`-[XCTMemoryChecker _assertInvalidObjectsDeallocatedAfterScope:] + 37
    frame #15: 0x00000001000c8040 XCTest`__24-[XCTestCase invokeTest]_block_invoke_2 + 665
    frame #16: 0x0000000100105916 XCTest`-[XCTestContext performInScope:] + 190
    frame #17: 0x00000001000c7d94 XCTest`-[XCTestCase invokeTest] + 254
    frame #18: RealmSwift Tests`TestCase.(self=0x0000608000089fb0) -> ()).(closure #1) at TestCase.swift:79
    frame #19: RealmSwift Tests`thunk at TestCase.swift:0
    frame #20: RealmSwift Tests`partial apply for thunk at TestCase.swift:0
    frame #21: 0x00000001021ef5c8 libswiftObjectiveC.dylib`ObjectiveC.autoreleasepool <A> (invoking : () throws -> A) throws -> A + 56
    frame #22: RealmSwift Tests`TestCase.invokeTest(self=0x0000608000089fb0) -> () at TestCase.swift:79
    frame #23: RealmSwift Tests`@objc TestCase.invokeTest() -> () at TestCase.swift:0
    frame #24: 0x00000001000c8803 XCTest`-[XCTestCase performTest:] + 565
    frame #25: 0x00000001000c5776 XCTest`__27-[XCTestSuite performTest:]_block_invoke + 300
    frame #26: 0x00000001000c5366 XCTest`-[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
    frame #27: 0x00000001000c554c XCTest`-[XCTestSuite performTest:] + 214
    frame #28: 0x00000001000c5776 XCTest`__27-[XCTestSuite performTest:]_block_invoke + 300
    frame #29: 0x00000001000c5366 XCTest`-[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
    frame #30: 0x00000001000c554c XCTest`-[XCTestSuite performTest:] + 214
    frame #31: 0x00000001000c5776 XCTest`__27-[XCTestSuite performTest:]_block_invoke + 300
    frame #32: 0x00000001000c5366 XCTest`-[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
    frame #33: 0x00000001000c554c XCTest`-[XCTestSuite performTest:] + 214
    frame #34: 0x000000010011883c XCTest`__44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
    frame #35: 0x00000001000dbe0e XCTest`-[XCTestObservationCenter _observeTestExecutionForBlock:] + 587
    frame #36: 0x00000001001186da XCTest`-[XCTTestRunSession runTestsAndReturnError:] + 281
    frame #37: 0x00000001000b11fb XCTest`-[XCTestDriver runTestsAndReturnError:] + 254
    frame #38: 0x0000000100107fc9 XCTest`_XCTestMain + 773
    frame #39: 0x00007fffb9f957dc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #40: 0x00007fffb9f767e4 CoreFoundation`__CFRunLoopDoBlocks + 356
    frame #41: 0x00007fffb9f75f65 CoreFoundation`__CFRunLoopRun + 917
    frame #42: 0x00007fffb9f75974 CoreFoundation`CFRunLoopRunSpecific + 420
    frame #43: 0x00007fffb9501a5c HIToolbox`RunCurrentEventLoopInMode + 240
    frame #44: 0x00007fffb9501799 HIToolbox`ReceiveNextEventCommon + 184
    frame #45: 0x00007fffb95016c6 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71
    frame #46: 0x00007fffb7aa75b4 AppKit`_DPSNextEvent + 1120
    frame #47: 0x00007fffb8221d6b AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2789
    frame #48: 0x00007fffb7a9bf35 AppKit`-[NSApplication run] + 926
    frame #49: 0x00007fffb7a66850 AppKit`NSApplicationMain + 1237
    frame #50: TestHost`main(argc=5, argv=0x00007fff5fbfef58) at main.m:40
    frame #51: 0x00007fffcf4d9255 libdyld.dylib`start + 1
    frame #52: 0x00007fffcf4d9255 libdyld.dylib`start + 1
  • Loading branch information
jpsim committed Feb 6, 2017
1 parent 539fbd9 commit db13fba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Realm/RLMResults.mm
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,18 @@ - (id)averageOfProperty:(NSString *)property {
}

- (void)deleteObjectsFromRealm {
return translateErrors([&] {
try {
if (_results.get_mode() == Results::Mode::Table) {
RLMResultsValidateInWriteTransaction(self);
RLMClearTable(*_info);
}
else {
RLMTrackDeletions(_realm, ^{ _results.clear(); });
}
});
}
catch (...) {
throwError(nil);
}
}

- (NSString *)description {
Expand Down

0 comments on commit db13fba

Please sign in to comment.