【问题标题】:Any clue about "SIGSEGV" Crash?关于“SIGSEGV”崩溃的任何线索?
【发布时间】:2010-12-08 15:07:16
【问题描述】:

我收到以下崩溃报告:

OS Version:      iPhone OS 4.2.1
Report Version:  104

Exception Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0x12803ea4
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                     0x0000930a realizeClass(class_t*) + 18
1   libobjc.A.dylib                     0x0000935d realizeClass(class_t*) + 101
2   libobjc.A.dylib                     0x0000953f prepareForMethodLookup + 51
3   libobjc.A.dylib                     0x00005f39 lookUpMethod + 41
4   libobjc.A.dylib                     0x00003781 _class_lookupMethodAndLoadCache + 13
5   libobjc.A.dylib                     0x000034b7 objc_msgSend_uncached + 27
6   Oculus                              0x0001449f -[TestSingleView downLightingEnded] (TestSingleView.m:52)

在以下方法中:

- (void) downLightingEnded {
    [currentTestItem removeFromSuperview];
    currentTestItem = nil;
    CGRect frame = CGRectMake(0, 0, [myTestData heightOfRow:newI], [myTestData heightOfRow:newI]); //line 52
    currentTestItem = [[TestItemView alloc] initWithFrame:frame AndEyeTestItem:[myTestData signAtRow:newI Column:newJ]];
    currentTestItem.alpha = 0.0;
    [self addSubview:currentTestItem];
    currentTestItem.center = self.center;

    [UIView beginAnimations:nil context:nil];
    currentTestItem.alpha = 1.0;
    [UIView commitAnimations];

    [currentTestItem release];
}

当然,当方法为 startet 时,“currentTestItem”可能为 nil,但向 nil 发送消息不是问题,所以这不是导致崩溃的原因。

有什么想法我必须搜索的方向吗?

我不知道在哪里搜索错误,因为这是客户发送的报告,我还不能重新创建它。

【问题讨论】:

  • 第 52 行是哪一行?
  • 好点,问题似乎出在“myTestData”上。到目前为止,我非常关注“currentTestItem”,谢谢。不幸的是,我无法通过点击那里造成任何崩溃,所以我仍然卡住了。
  • 6 Oculus... 是我想的那样吗?

标签: iphone objective-c crash segmentation-fault


【解决方案1】:

currentTestItem 是否可以为非 nil,但指向已释放的对象?

通过启用僵尸来检查(提示 #1):

http://www.loufranco.com/blog/files/debugging-memory-iphone.html

编辑(基于 OP 对问题的评论):myTestData 可能是僵尸——通过启用僵尸来检查。基本上,它告诉 Objective-C 不要释放保留计数为 0 的对象。相反,它会将它们标记为 Zombie。如果您向 Zombie 发送任何消息,它会通知您。

【讨论】:

  • 既然他给它赋值 nil,我不认为是这样。
  • 他首先向旧实例发送一条释放消息,然后再分配 nil 给它。
  • 娄在他的编辑中所说的;在我们看到更多代码之前,假设myTestData 已被过度发布是一个很好的假设。 (我编辑了答案,没有提及retainCount;一个对象的retainCount 永远不能为零......)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-04-01
  • 2015-03-28
  • 2011-06-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多