Advertisement
Guest User

Untitled

a guest
Apr 19th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.43 KB | None | 0 0
  1. #0 0x981f3876 in __psynch_mutexwait ()
  2. #1 0x97a016af in pthread_mutex_lock ()
  3. #2 0x0135be32 in -[_PFLock lock] ()
  4. #3 0x0135be0a in -[NSPersistentStoreCoordinator lock] ()
  5. #4 0x01371d1c in -[NSManagedObjectContext(_NSInternalAdditions) lockObjectStore] ()
  6. #5 0x013702c0 in -[NSManagedObjectContext executeFetchRequest:error:] ()
  7. #6 0x0000a701 in -[NSManagedObjectContext(Convenience) fetchObjectsForEntityName:onlyIDs:withPredicate:] at /Users/mike/Dropbox/src/Tracky-iPhone/Tracky/Tracky/NSManagedObjectContext(Convenience).m:50
  8. #7 0x00065270 in +[NSManagedObject(ContextAdditions) contextForID:managedObjectContext:] at /Users/mike/Dropbox/src/Tracky-iPhone/Tracky/Tracky/NSManagedObject+ContextAdditions.m:40
  9. #8 0x0006597e in __85+[NSManagedObject(ContextAdditions) createContextIfNeededForID:managedObjectContext:]_block_invoke_0 at /Users/mike/Dropbox/src/Tracky-iPhone/Tracky/Tracky/NSManagedObject+ContextAdditions.m:55
  10. #9 0x00065aad in __85+[NSManagedObject(ContextAdditions) createContextIfNeededForID:managedObjectContext:]_block_invoke_050 at /Users/mike/Dropbox/src/Tracky-iPhone/Tracky/Tracky/NSManagedObject+ContextAdditions.m:64
  11. #10 0x023cf8d9 in _dispatch_barrier_sync_f_slow_invoke ()
  12. #11 0x023d0509 in _dispatch_main_queue_callback_4CF ()
  13. #12 0x01ae9803 in __CFRunLoopRun ()
  14. #13 0x01ae8d84 in CFRunLoopRunSpecific ()
  15. #14 0x01ae8c9b in CFRunLoopRunInMode ()
  16. #15 0x019b47d8 in GSEventRunModal ()
  17. #16 0x019b488a in GSEventRun ()
  18. #17 0x004ba626 in UIApplicationMain ()
  19.  
  20. Thread 18, Queue : (null)
  21. #0 0x981f1c5e in semaphore_wait_trap ()
  22. #1 0x023d1bda in _dispatch_thread_semaphore_wait ()
  23. #2 0x023d0cb2 in _dispatch_barrier_sync_f_slow ()
  24. #3 0x023d0e0f in dispatch_barrier_sync_f ()
  25. #4 0x023d0f4c in _dispatch_sync_slow ()
  26. #5 0x0006563a in +[NSManagedObject(ContextAdditions) createContextIfNeededForID:managedObjectContext:] at /Users/mike/Dropbox/src/Tracky-iPhone/Tracky/Tracky/NSManagedObject+ContextAdditions.m:63
  27. #6 0x0006e2ee in __109-[ItemFetcher createOrConfigureObjectWithDescriptor:withContext:jsonObjectIDKey:modelObjectIDKey:entityName:]_block_invoke_0 at /Users/mike/Dropbox/src/Tracky-iPhone/Tracky/Tracky/ItemFetcher.m:78
  28. #7 0x023ce330 in _dispatch_call_block_and_release ()
  29. #8 0x023cff0c in _dispatch_queue_drain ()
  30. #9 0x023cfcb4 in _dispatch_queue_invoke ()
  31. #10 0x023cf402 in _dispatch_worker_thread2 ()
  32. #11 0x97a04b24 in _pthread_wqthread ()
  33.  
  34. + (Context *) createContextIfNeededForID: (NSString *) contextID managedObjectContext:(NSManagedObjectContext *) moc
  35. {
  36. // See if this context is in the main MOC. This call needs to happen synchronously on the main queue, if we're
  37. // not on the main queue
  38. Context * (^contextFromMainMOCBlock)(void) =
  39. ^ `Context` * {
  40. // We are guaranteed to be in the main here; look at how this block is invoked.
  41. return [self contextForID:contextID managedObjectContext:[UIApplication trackyAppDelegate].managedObjectContext] ;
  42. } ;
  43.  
  44. __block Context *contextFromMainMOC = nil ;
  45.  
  46. if( [UIApplication trackyAppDelegate].managedObjectContext == moc )
  47. contextFromMainMOC = contextFromMainMOCBlock() ;
  48. else
  49. dispatch_sync(dispatch_get_main_queue(), ^{
  50. contextFromMainMOC = contextFromMainMOCBlock() ; // <-- here
  51. }) ;
  52.  
  53. Thread 3, Queue : (null)
  54. #0 0x981f490a in kevent ()
  55. #1 0x023d0372 in _dispatch_mgr_invoke ()
  56. #2 0x023cebe1 in _dispatch_mgr_thread ()
  57. Thread 5 WebThread, Queue : (null)
  58. #0 0x981f1c22 in mach_msg_trap ()
  59. #1 0x981f11f6 in mach_msg ()
  60. #2 0x01b8610a in __CFRunLoopServiceMachPort ()
  61. #3 0x01ae95d5 in __CFRunLoopRun ()
  62. #4 0x01ae8d84 in CFRunLoopRunSpecific ()
  63. #5 0x01ae8c9b in CFRunLoopRunInMode ()
  64. #6 0x04776420 in _ZL12RunWebThreadPv ()
  65. #7 0x97a02ed9 in _pthread_start ()
  66. Thread 6 com.apple.NSURLConnectionLoader, Queue : (null)
  67. #0 0x981f1c22 in mach_msg_trap ()
  68. #1 0x981f11f6 in mach_msg ()
  69. #2 0x01b8610a in __CFRunLoopServiceMachPort ()
  70. #3 0x01ae95d5 in __CFRunLoopRun ()
  71. #4 0x01ae8d84 in CFRunLoopRunSpecific ()
  72. #5 0x01ae8c9b in CFRunLoopRunInMode ()
  73. #6 0x00ebae30 in +[NSURLConnection(Loader) _resourceLoadLoop:] ()
  74. #7 0x00dcc4d6 in -[NSThread main] ()
  75. #8 0x00dcc447 in __NSThread__main__ ()
  76. #9 0x97a02ed9 in _pthread_start ()
  77. Thread 10 com.apple.CFSocket.private, Queue : (null)
  78. #0 0x981f3b42 in select$DARWIN_EXTSN ()
  79. #1 0x01b1a7cb in __CFSocketManager ()
  80. #2 0x97a02ed9 in _pthread_start ()
  81.  
  82. + (Context *) contextForID: (NSString *) contextID managedObjectContext:(NSManagedObjectContext *) moc
  83. {
  84. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"cid == %@", contextID] ;
  85. NSSet *contexts = [moc fetchObjectsForEntityName:@"Context" onlyIDs:NO withPredicate:predicate] ;
  86.  
  87. // Integrity check
  88. NSAssert1(contexts.count < 2, @"More than one context with the same CID exists: %@" , contexts) ;
  89.  
  90. return [contexts anyObject] ;
  91. }
  92.  
  93. - (NSSet *)fetchObjectsForEntityName:(NSString *)newEntityName onlyIDs: (BOOL) onlyIDs
  94. withPredicate:(id)stringOrPredicate, ...
  95. {
  96. NSEntityDescription *entity = [NSEntityDescription
  97. entityForName:newEntityName inManagedObjectContext:self];
  98.  
  99. NSAssert1( entity != nil , @"entity not found for "%@"" , newEntityName ) ;
  100.  
  101. NSFetchRequest *request = [[NSFetchRequest alloc] init];
  102. [request setEntity:entity];
  103. [request setIncludesPropertyValues:!onlyIDs] ;
  104.  
  105. if (stringOrPredicate)
  106. {
  107. NSPredicate *predicate;
  108. if ([stringOrPredicate isKindOfClass:[NSString class]])
  109. {
  110. va_list variadicArguments;
  111. va_start(variadicArguments, stringOrPredicate);
  112. predicate = [NSPredicate predicateWithFormat:stringOrPredicate
  113. arguments:variadicArguments];
  114. va_end(variadicArguments);
  115. }
  116. else
  117. {
  118. NSAssert2([stringOrPredicate isKindOfClass:[NSPredicate class]],
  119. @"Second parameter passed to %s is of unexpected class %@",
  120. sel_getName(_cmd), NSStringFromClass(stringOrPredicate));
  121. predicate = (NSPredicate *)stringOrPredicate;
  122. }
  123. [request setPredicate:predicate];
  124. }
  125.  
  126. NSError *error = nil;
  127. NSArray *results ;
  128. @try {
  129. results = [self executeFetchRequest:request error:&error];
  130. }
  131. @catch (NSException *exception) {
  132. NSLog(@"Exception caught: %@" , exception) ;
  133. }
  134.  
  135. if (error != nil)
  136. {
  137. [NSException raise:NSGenericException format:@"%@",[error description]];
  138. }
  139.  
  140. return [NSSet setWithArray:results];
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement