我有我的应用程序的用户,有时当他们运行应用程序时,它会在以下某点停留...
0x92542782 in __semwait_signal ()
(gdb) where
#0 0x92542782 in __semwait_signal ()
#1 0x9254243e in _pthread_cond_wait ()
#2 0x925440d8 in pthread_cond_wait$UNIX2003 ()
#3 0x95232670 in fe_fragment_render_quad ()
#4 0x9522f07f in fe_sw_quad ()
#5 0x9522edf9 in fe_context_quad ()
#6 0x95227915 in fe_tree_render_apply_1 ()
#7 0x9522244f in fe_tree_render_apply ()
#8 0x95220c9b in fe_tree_render_ ()
#9 0x9522443c in fe_tree_render_texture ()
#10 0x95224295 in texture_retain ()
#11 0x95223d5d in fe_texture_new ()
#12 0x95222a62 in fe_tree_create_texture ()
#13 0x95222159 in fe_tree_render_apply ()
#14 0x95220c9b in fe_tree_render_ ()
#15 0x9522443c in fe_tree_render_texture ()
#16 0x95224295 in texture_retain ()
#17 0x95223d5d in fe_texture_new ()
#18 0x95222a62 in fe_tree_create_texture ()
#19 0x95222159 in fe_tree_render_apply ()
#20 0x95220c9b in fe_tree_render_ ()
#21 0x9522443c in fe_tree_render_texture ()
#22 0x95224295 in texture_retain ()
#23 0x95223d5d in fe_texture_new ()
#24 0x95222a62 in fe_tree_create_texture ()
#25 0x95222159 in fe_tree_render_apply ()
#26 0x95220c9b in fe_tree_render_ ()
#27 0x95220bef in fe_tree_render_ ()
#28 0x9522443c in fe_tree_render_texture ()
#29 0x95224295 in texture_retain ()
#30 0x95223d5d in fe_texture_new ()
#31 0x95222a62 in fe_tree_create_texture ()
#32 0x95222159 in fe_tree_render_apply ()
#33 0x95220c9b in fe_tree_render_ ()
#34 0x952201e2 in fe_tree_render_tree ()
#35 0x9520e72a in fe_tree_render_image ()
#36 0x9520dfea in fe_image_render_ ()
#37 0x9520dae7 in fe_image_get_bitmap ()
#38 0x9520d8b7 in -[CIContextImpl render:toBitmap:rowBytes:bounds:format:colorSpace:] ()
#39 0x918f29e8 in cgxcoreimage_instance_render ()
#40 0x918f2ae8 in cgxcoreimage_provider_create_data ()
#41 0x9841d601 in faultDataAcquireBytePointer ()
#42 0x9837f20f in CGAccessSessionGetBytePointer ()
#43 0x983db0e0 in img_decode_read ()
#44 0x983daf47 in img_colormatch_read ()
#45 0x983dad7c in img_alphamerge_read ()
#46 0x983b8ee9 in img_data_lock ()
#47 0x983b5ee6 in CGSImageDataLock ()
#48 0x92b16748 in ripc_AcquireImage ()
#49 0x92b143be in ripc_DrawImage ()
#50 0x983b5b60 in CGContextDrawImage ()
#51 0x990ed9c6 in CUIPenCG::DrawImage ()
#52 0x990f9e85 in CUIRenderer::DrawImage ()
#53 0x990eaa94 in CUIRenderer::Draw ()
#54 0x90d6059c in -[NSCoreUIImageRep draw] ()
#55 0x90d60481 in -[NSImageRep drawInRect:] ()
#56 0x90d602fd in __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_2 ()
#57 0x90d6025b in NSGraphicsContextPushContextWithFlippedMetadata_drawWithBlock_ ()
#58 0x90cb4673 in __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 ()
#59 0x90cb3b39 in -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] ()
#60 0x90caed89 in -[NSImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] ()
#61 0x90d5f42e in -[NSButtonCell drawImage:withFrame:inView:] ()
#62 0x90d5e941 in -[NSButtonCell _configureAndDrawImageWithRect:cellFrame:controlView:] ()
#63 0x90d5cba8 in -[NSButtonCell drawInteriorWithFrame:inView:] ()
#64 0x90d5c1bd in -[NSButtonCell drawWithFrame:inView:] ()
#65 0x90d5489e in -[NSControl drawRect:] ()
#66 0x90d4cce1 in -[NSView _drawRect:clip:] ()
#67 0x90d4b97f in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#68 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#69 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#70 0x90d730c2 in -[NSToolbarItemViewer _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#71 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#72 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#73 0x90d4bcb4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#74 0x90d49e9e in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#75 0x90d49a13 in -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
#76 0x90d46359 in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
#77 0x90ca6f26 in -[NSView displayIfNeeded] ()
#78 0x90c70292 in -[NSWindow displayIfNeeded] ()
#79 0x90c6ed30 in -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()
#80 0x90c6e892 in -[NSWindow orderWindow:relativeTo:] ()
#81 0x90c6c054 in -[NSWindow makeKeyAndOrderFront:] ()
#82 0x000151a2 in -[AppController applicationFinishedLaunching:] ()
#83 0x9208f253 in _nsnote_callback ()
#84 0x98facc29 in __CFXNotificationPost ()
#85 0x98fac65a in _CFXNotificationPostNotification ()
#86 0x92084120 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#87 0x920914fd in -[NSNotificationCenter postNotificationName:object:] ()
#88 0x90ca78f2 in -[NSApplication _postDidFinishNotification] ()
#89 0x90ca7802 in -[NSApplication _sendFinishLaunchingNotification] ()
#90 0x90dfe565 in -[NSApplication(NSAppleEventHandling) _handleAEOpen:] ()
#91 0x90dfe185 in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] ()
#92 0x920c446c in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] ()
#93 0x920c4230 in _NSAppleEventManagerGenericHandler ()
#94 0x929c0de6 in aeDispatchAppleEvent ()
#95 0x929c0ce5 in dispatchEventAndSendReply ()
#96 0x929c0bf2 in aeProcessAppleEvent ()
#97 0x97cae381 in AEProcessAppleEvent ()
#98 0x90c77ed2 in _DPSNextEvent ()
#99 0x90c7750a in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#100 0x90c3969b in -[NSApplication run] ()
#101 0x90c31735 in NSApplicationMain ()
#102 0x0000262e in start ()
(gdb)
当您再调试一下并打印NSImage实例时,它正在尝试绘制...
(gdb) frame 60
(gdb) po *(int*)($ebp+8)
<NSImage 0x1261f10 Name=ForwardTemplate Size={20, 20} Reps=(
NSPDFImageRep 0x18abc30 Size={20, 20} ColorSpace=NSCalibratedRGBColorSpace BPS=0 Pixels=20x20 Alpha=NO
)>
这是应用程序工具栏中“正向传输”自定义按钮的模板图像之一。 (有关屏幕截图,请参阅http://www.cancelmonday.com/beatler)
我正在寻找有关我可以做些什么来尝试进一步调试的想法,因为困难的是只有这一个用户报告此问题并且我无法在本地重现它。
非常感谢任何帮助。
更新
感谢 diciu 我跑了......
thread apply all bt
这确实显示了一个线程加载等待的问题,一个线程的示例堆栈是......
Thread 365 (process 1866):
#0 0x92542782 in __semwait_signal ()
#1 0x9254243e in _pthread_cond_wait ()
#2 0x925440d8 in pthread_cond_wait$UNIX2003 ()
#3 0x920b7b5e in -[NSCondition wait] ()
#4 0x920a5531 in -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] ()
#5 0x920b7cb7 in -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] ()
#6 0x000183e8 in -[BLImageLoader main] ()
#7 0x920b73b3 in -[__NSOperationInternal start] ()
#8 0x920b6fe0 in ____startOperations_block_invoke_2 ()
#9 0x925487b8 in _dispatch_call_block_and_release ()
#10 0x9253a97e in _dispatch_worker_thread2 ()
#11 0x9253a401 in _pthread_wqthread ()
#12 0x9253a246 in start_wqthread ()
这些线程会更新UI,但始终通过...
完成[item performSelectorOnMainThread:@selector(setDisplayImage:) withObject:image waitUntilDone:YES];
我认为这是安全的,有很多线程的问题,例如400多人都想要......
performSelectorOnMainThread
......在同一时期内?
答案 0 :(得分:6)
您的主线程被阻止等待条件发生( pthread_cond_wait $ UNIX2003 )。
您是否从非主线程更新UI?
在gdb中
thread apply all bt
将向您显示所有应用程序的线程的状态 - 可能是您的主线程被其他一些执行UI操作的线程阻止。