2

I'm getting a weird EXC_BAD_INSTRUCTION crash when I'm using dispatch_group_t. I'm using MagicalRecord and my success block gets triggered after a MagicalRecord save. My dispatch_group_leave(group) line crashes if there are no changes to save - otherwise it works fine. I have several of these similar calls that are a part of the group, and I'm experiencing the same issue with all of them. I'm totally lost...any ideas?

Below is my code:

// Create a group that will wait until all the profile elements have been update before hiding the activity indicator
dispatch_group_t group = dispatch_group_create();

dispatch_group_enter(group);
[self.user readProfileWithContext:self.backgroundMOC
                          success:^{
                              dispatch_async(dispatch_get_main_queue(), ^{
                                  [self.view setPreferencesForUser:self.user];
                              });
                              // I get the crash on this line when Magical Record doesn't have any changes
                              dispatch_group_leave(group);
                          } failure:^(NSError *error) {
                              dispatch_group_leave(group);
                          }];

Edit I don't get any output in the console, but I do get this as the issue in the backtrace (not sure if this is helpful): enter image description here

coder
  • 10,460
  • 17
  • 72
  • 125
  • EXC_BAD_INSTRUCTION probably means an assertion is failing inside libdispatch itself. What is the complete backtrace of the crash? Do you get any output in the system console? – Greg Parker Mar 17 '14 at 20:28
  • @GregParker Hmmm...I'm not sure how to fix that issue. I added a screenshot of the backtrace – coder Mar 18 '14 at 13:40
  • That's not a backtrace, that's just the assembly display of one frame in the backtrace. – Greg Parker Mar 18 '14 at 19:04
  • Looks like the same as http://stackoverflow.com/q/24337791/900873, something is probably being deallocated early. – Kevin Jun 17 '15 at 17:21

0 Answers0