2015-04-05 43 views
2

由于某种原因,我的应用程序崩溃了,而且我不确定是什么原因导致问题,除了它似乎与处理文件时出现的分派队列有关。任何帮助将不胜感激。线程错误BAD_ACCESS(SIGSEGV)

Crashed Thread: 0 Dispatch queue: com.apple.main-thread 

Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000038 

VM Regions Near 0x38: 
--> 
    __TEXT     00000001018e7000-000000010190b000 [ 144K] r-x/rwx SM=COW /Users/USER/Desktop/MaviÃÅ 10.8 Build.app/Contents/MacOS/MaviÃÅ 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 
0 libdispatch.dylib    0x00007fff8c83dc28 dispatch_async_f + 3 
1 com.larod.mavi     0x00000001018f6e12 0x1018e7000 + 65042 
2 com.apple.AppKit    0x00007fff890df99e -[NSTableView performDragOperation:] + 215 
3 com.apple.AppKit    0x00007fff88f2c94f NSCoreDragReceiveMessageProc + 1651 
4 com.apple.HIServices   0x00007fff8a8f046a DoMultipartDropMessage + 301 
5 com.apple.HIServices   0x00007fff8a8f0135 DoDropMessage + 49 
6 com.apple.HIServices   0x00007fff8a8f0c5e CoreDragMessageHandler + 1543 
7 com.apple.CoreFoundation  0x00007fff89ca858d __CFMessagePortPerform + 701 
8 com.apple.CoreFoundation  0x00007fff89bbcd09 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41 
9 com.apple.CoreFoundation  0x00007fff89bbca49 __CFRunLoopDoSource1 + 153 
10 com.apple.CoreFoundation  0x00007fff89befc02 __CFRunLoopRun + 1826 
11 com.apple.CoreFoundation  0x00007fff89bef0e2 CFRunLoopRunSpecific + 290 
12 com.apple.HIToolbox    0x00007fff8871beb4 RunCurrentEventLoopInMode + 209 
13 com.apple.HIToolbox    0x00007fff8871bc52 ReceiveNextEventCommon + 356 
14 com.apple.HIToolbox    0x00007fff8871bae3 BlockUntilNextEventMatchingListInMode + 62 
15 com.apple.AppKit    0x00007fff88bdb533 _DPSNextEvent + 685 
16 com.apple.AppKit    0x00007fff88bdadf2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128 
17 com.apple.AppKit    0x00007fff88bd21a3 -[NSApplication run] + 517 
18 com.apple.AppKit    0x00007fff88b76bd6 NSApplicationMain + 869 
19 libdyld.dylib     0x00007fff85ff97e1 start + 1 

Thread 1: 
0 libsystem_kernel.dylib   0x00007fff8404a6d6 __workq_kernreturn + 10 
1 libsystem_c.dylib    0x00007fff8c8bdf1c _pthread_workq_return + 25 
2 libsystem_c.dylib    0x00007fff8c8bdce3 _pthread_wqthread + 412 
3 libsystem_c.dylib    0x00007fff8c8a8191 start_wqthread + 13 

Thread 2:: Dispatch queue: com.apple.libdispatch-manager 
0 libsystem_kernel.dylib   0x00007fff8404ad16 kevent + 10 
1 libdispatch.dylib    0x00007fff8c83fdea _dispatch_mgr_invoke + 883 
2 libdispatch.dylib    0x00007fff8c83f9ee _dispatch_mgr_thread + 54 

Thread 3:: CVDisplayLink 
0 libsystem_kernel.dylib   0x00007fff8404a0fa __psynch_cvwait + 10 
1 libsystem_c.dylib    0x00007fff8c8bffb9 _pthread_cond_wait + 869 
2 com.apple.CoreVideo    0x00007fff8761b2a1 CVDisplayLink::runIOThread() + 689 
3 com.apple.CoreVideo    0x00007fff8761afd7 startIOThread(void*) + 148 
4 libsystem_c.dylib    0x00007fff8c8bb772 _pthread_start + 327 
5 libsystem_c.dylib    0x00007fff8c8a81a1 thread_start + 13 

Thread 0 crashed with X86 Thread State (64-bit): 
    rax: 0x00007fc1a0434f90 rbx: 0x0000000000000000 rcx: 0xffff803e5fbcafaf rdx: 0x00007fff8c840ef2 
    rdi: 0x0000000000000000 rsi: 0x00007fc1a0434f90 rbp: 0x00007fff5e317000 rsp: 0x00007fff5e316f58 
    r8: 0xffff803e5fbcafaf r9: 0x00000000000000ff r10: 0x00007fc1a100ec00 r11: 0x0000000005d414ad 
    r12: 0x00007fff8602d360 r13: 0x00007fc1a0435050 r14: 0x00007fc1a0435050 r15: 0x00007fff8602df50 
    rip: 0x00007fff8c83dc28 rfl: 0x0000000000010206 cr2: 0x0000000000000038 
Logical CPU: 0 

External Modification Summary: 
    Calls made by other processes targeting this process: 
    task_for_pid: 2 
    thread_create: 0 
    thread_set_state: 0 
    Calls made by this process: 
    task_for_pid: 0 
    thread_create: 0 
    thread_set_state: 0 
    Calls made by all processes on this machine: 
    task_for_pid: 28757 
    thread_create: 0 
    thread_set_state: 0 

VM Region Summary: 
ReadOnly portion of Libraries: Total=187.9M resident=78.8M(42%) swapped_out_or_unallocated=109.1M(58%) 
Writable regions: Total=155.6M written=3596K(2%) resident=14.4M(9%) swapped_out=0K(0%) unallocated=141.2M(91%) 

REGION TYPE      VIRTUAL 
===========      ======= 
CG backing stores     2280K 
CG image        4K 
CG raster data      56K 
CG shared images     1184K 
CoreAnimation      44K 
CoreImage        4K 
CoreServices      1724K 
IOKit        4476K 
IOKit (reserved)      4K  reserved VM address space (unallocated) 
MALLOC       114.6M 
MALLOC guard page     48K 
Memory tag=240      4K 
Memory tag=242      12K 
Memory tag=251      8K 
OpenCL        8K 
OpenGL GLSL      1936K 
OpenGL GLSL (reserved)    128K  reserved VM address space (unallocated) 
SQLite page cache     96K 
STACK GUARD      56.0M 
Stack        9752K 
VM_ALLOCATE      16.2M 
__DATA        37.2M 
__IMAGE        528K 
__LINKEDIT       54.5M 
__TEXT       133.4M 
__UNICODE       544K 
mapped file      41.9M 
shared memory      372K 
===========      ======= 
TOTAL        476.4M 
TOTAL, minus reserved VM space 476.3M 

这是我认为崩溃应用程序的实际代码。

dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ 
     unsigned long __block current = 0; 
     unsigned long total = 0; 

     dispatch_sync(dispatch_get_main_queue(), ^{ 
      _fileOperation = YES; 
      [_fileCopyProgress setHidden:NO]; 
      [_fileCopyProgress startAnimation:self]; 
      [_processString setStringValue:@"Scanning..."]; 
      [_processString setHidden:NO]; 
     }); 

     for (NSURL* url in pboardObjects) { 
      [self scanFileURLSForImport:url]; 
     } 

     total = _mediaFileURLSForImport.count; 
     [self updateImportProcess:current of:total]; 

     [_processString setStringValue:@"Importing..."]; 

     for (NSURL* url in _mediaFileURLSForImport) { 
      [self performSelectorOnMainThread:@selector(createVideo_2:) withObject:url waitUntilDone:YES]; 
      [self updateImportProcess:(++current) of:total]; 
     } 

     [self performSelectorOnMainThread:@selector(saveAction:) withObject:nil waitUntilDone:YES]; 
     [_tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES]; 
     [self performSelectorOnMainThread:@selector(selectImportedFiles:) withObject:nil waitUntilDone:YES]; 

     dispatch_sync(dispatch_get_main_queue(), ^{ 
      _fileOperation = NO; 
      [_processString setStringValue:@""]; 
      [_processString setHidden:YES]; 
      [_fileCopyProgress setHidden:YES]; 
      [_fileCopyProgress stopAnimation:self]; 
     }); 
    }); 

要添加有点扭曲的,这种碰撞不会对我的测试机发生的一切完美地运行在那里,应用程序提交到应用商店,并得到苹果的批准,这意味着在这两个测试常规和来宾帐户。但昨天它每次都在同事机器上坠毁。我必须试图解决它的唯一问题是他的机器上的这个报告。我无法在我的测试机器上复制这个,所有东西都可以在那里工作。

回答

2

Symbolicate您的崩溃报告。之后你会看到你的代码在崩溃中涉及的部分堆栈。

1 com.larod.mavi     0x00000001018f6e12 0x1018e7000 + 65042 
0

挂钩lldb并设置异常断点以破坏崩溃的位置,并通过lldb中的bt命令检查堆栈跟踪。通常情况下,通过写入只能读取的内存来获得内存崩溃,或者正在访问被释放的对象。从日志中,我假设你拖动Views并执行某些操作,你确定相关视图在块中仍然有效吗?所有的意见应该在主线程上,仍然在内存中有效

+0

要添加一点扭曲,这个崩溃不会发生在我的测试机器上,所有的一切都运行完美,应用程序已提交到应用商店,并通过苹果,这意味着它在常规和来宾帐户中都经过了测试。但昨天它每次都在同事机器上坠毁。我必须试图解决它的唯一问题是他的机器上的这个报告。我无法在我的测试机器上复制这个,所有东西都可以在那里工作。 – larod 2015-04-05 17:32:26

+0

在其他机器上会发生这种情况,机器型号和操作系统版本是什么?尝试使用相同的型号和操作系统版本,或者你可以借用机器进行调试? – Wingzero 2015-04-05 23:12:47

+0

实际上是一台新机器,他有一个mac pro,更新的型号,我在macbook pro上做我的开发工具,我的测试机器是mac mini。我会再次尝试下个周末,这个bug非常不寻常。如果没有他的机器,很难象征,但我会尽我所能。 – larod 2015-04-06 00:28:49