我在UITableViewCells中有一个带有几个 UIWebViews 的应用程序,这些应用程序正在呈现一些本地加载的HTML,并应用了一些额外的Javascript库(例如Prettify.js)。
UITableViewCell内最多只有一个UIWebView。事情总体上运作良好,除了当我加载了很多UIWebViews,并且来回旋转设备时,我从WebCore::RenderBlock
获得了可重复的崩溃。
我尝试过的一些古怪的想法(并且失败了):
我开始没有想法了,我正在寻找有关如何解决这个问题的新方法。有没有人遇到过这种问题?
我目前的结论是因为UIWebView -> WebCore
与UIKit轮换/呈现线程之间存在一些线程同步问题。
thread #1: tid = 0x2355ad, 0x0077c976 libgmalloc.dylib`breakIfDebugging + 158, queue = 'com.apple.main-thread, stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x0077c976 libgmalloc.dylib`breakIfDebugging + 158
frame #1: 0x0077cbcf libgmalloc.dylib`GMmalloc_zone_malloc_internal + 182
frame #2: 0x0077bcfe libgmalloc.dylib`GMmalloc_zone_malloc + 161
frame #3: 0x0077bb7f libgmalloc.dylib`GMmalloc_zone_calloc + 180
frame #4: 0x0077b7a4 libgmalloc.dylib`GMcalloc + 58
frame #5: 0x0d82f3cd libCGFreetype.A.dylib`(anonymous namespace)::allocate(FT_MemoryRec_*, long) + 25
frame #6: 0x0d8311f5 libCGFreetype.A.dylib`ft_mem_alloc + 29
frame #7: 0x0d841991 libCGFreetype.A.dylib`T1_Face_Init + 611
frame #8: 0x0d832565 libCGFreetype.A.dylib`open_face + 155
frame #9: 0x0d831fbe libCGFreetype.A.dylib`FT_Open_Face + 390
frame #10: 0x0d826ccc libCGFreetype.A.dylib`(anonymous namespace)::open_face(FT::stream*, long, __CFString const*) + 79
frame #11: 0x0d826e26 libCGFreetype.A.dylib`FT::font::create_fonts_with_path(__CFString const*) + 86
frame #12: 0x0d82f536 libCGFreetype.A.dylib`(anonymous namespace)::create_private_data_with_path(__CFString const*) + 34
frame #13: 0x009dffa8 CoreGraphics`CGFontCreateFontsWithPath + 44
frame #14: 0x0090132e CoreGraphics`add_fonts_at_path_locked + 42
frame #15: 0x0090229f CoreGraphics`fault_all_locked + 212
frame #16: 0x00901e3f CoreGraphics`apply_function_locked + 42
frame #17: 0x00901de3 CoreGraphics`CGFontDBApplyFunction + 77
frame #18: 0x009e00a0 CoreGraphics`CGFontApplyFunction + 88
frame #19: 0x00b8f87b CoreText`TDescriptorSource::CreateAllDescriptorsCache(void*) + 73
frame #20: 0x032d84b0 libdispatch.dylib`_dispatch_client_callout + 14
frame #21: 0x032c7e17 libdispatch.dylib`dispatch_once_f + 182
frame #22: 0x00b8fb59 CoreText`TDescriptorSource::CopyCachedAllDescriptors() + 171
frame #23: 0x00b8fb78 CoreText`TDescriptorSource::CopyAllDescriptorsInternal(bool, CFComparisonResult (*)(void const*, void const*, void*)) const + 26
frame #24: 0x00b8fcdf CoreText`TDescriptorSource::CopyAllDescriptors() const + 79
frame #25: 0x00b9153e CoreText`TDescriptorSource::CopyDescriptorsForRequest(__CFDictionary const*, __CFSet const*, CFComparisonResult (*)(void const*, void const*, void*), void*, unsigned long) const + 3040
frame #26: 0x00b9070f CoreText`TDescriptorSource::CopySystemWideFallbackDescriptor(CGFont*, unsigned short const*, long, UIFontFlag) const + 797
frame #27: 0x00b91f16 CoreText`TDescriptorSource::CopySystemWideFallbackDescriptor(CGFont*, __CFString const*, CFRange, UIFontFlag) const + 210
frame #28: 0x00b7e8b6 CoreText`TFontCascade::CreateSystemWideFallback(__CTFont const*, __CFString const*, CFRange) const + 132
frame #29: 0x00b7e35c CoreText`TFontCascade::CreateFallback(__CTFont const*, __CFString const*, CTEmojiPolicy) const + 1446
frame #30: 0x00b53d0b CoreText`TGlyphEncoder::AppendUnmappedCharRun(TCFRef<CTRun*>&, __CTFont const*, CFRange, CFRange, TGlyphList<TDeletedGlyphIndex>&, TGlyphList<TDeletedGlyphIndex>&, TFontCascade const&, TGlyphEncoder::ClusterMatching) + 453
frame #31: 0x00b538b7 CoreText`TGlyphEncoder::RunUnicodeEncoderRecursively(TCFRef<CTRun*>&&, __CTFont const*, CFRange, TGlyphList<TDeletedGlyphIndex>&, TGlyphList<TDeletedGlyphIndex>&, TFontCascade const*, TGlyphEncoder::ClusterMatching, bool) + 1443
frame #32: 0x00b5326e CoreText`TGlyphEncoder::RunUnicodeEncoder(TCFRef<CTRun*>&&, __CTFont const*, CFRange, TGlyphList<TDeletedGlyphIndex>&, TFontCascade const*) + 166
frame #33: 0x00b52c89 CoreText`TGlyphEncoder::EncodeChars(CFRange, TAttributes const&, TGlyphList<TDeletedGlyphIndex>&, TGlyphEncoder::Fallbacks) + 1257
frame #34: 0x00b67a65 CoreText`TTypesetterUniChar::Initialize() + 355
frame #35: 0x00b678c6 CoreText`TTypesetterUniChar::TTypesetterUniChar(unsigned short const* (*)(long, long*, __CFDictionary const**, void*), void (*)(unsigned short const*, void*), void*) + 178
frame #36: 0x00b576ac CoreText`CTLineCreateWithUniCharProvider + 80
frame #37: 0x07f79c4a WebCore`WebCore::ComplexTextController::collectComplexTextRunsForCharacters(unsigned short const*, unsigned int, unsigned int, WebCore::SimpleFontData const*) + 1674
frame #38: 0x07f7503c WebCore`WebCore::ComplexTextController::collectComplexTextRuns() + 620
frame #39: 0x07f749f8 WebCore`WebCore::ComplexTextController::ComplexTextController(WebCore::Font const*, WebCore::TextRun const&, bool, WTF::HashSet<WebCore::SimpleFontData const*, WTF::PtrHash<WebCore::SimpleFontData const*>, WTF::HashTraits<WebCore::SimpleFontData const*> >*, bool) + 696
frame #40: 0x07f78ab8 WebCore`WebCore::TextLayout::TextLayout(WebCore::RenderText*, WebCore::Font const&, float) + 152
frame #41: 0x07f7457a WebCore`WebCore::Font::createLayout(WebCore::RenderText*, float, bool) const + 170
frame #42: 0x089baaa7 WebCore`WebCore::RenderBlock::LineBreaker::nextSegmentBreak(WebCore::BidiResolver<WebCore::InlineIterator, WebCore::BidiRun>&, WebCore::LineInfo&, WebCore::RenderBlock::RenderTextInfo&, WebCore::RenderBlock::FloatingObject*, unsigned int, WTF::Vector<WebCore::WordMeasurement, 64ul, WTF::CrashOnOverflow>&) + 6855
frame #43: 0x089b42f7 WebCore`WebCore::RenderBlock::layoutRunsAndFloatsInRange(WebCore::LineLayoutState&, WebCore::BidiResolver<WebCore::InlineIterator, WebCore::BidiRun>&, WebCore::InlineIterator const&, WebCore::BidiStatus const&, unsigned int) + 583
frame #44: 0x089b3438 WebCore`WebCore::RenderBlock::layoutRunsAndFloats(WebCore::LineLayoutState&, bool) + 1336
frame #45: 0x089b6dbf WebCore`WebCore::RenderBlock::layoutInlineChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 2543
frame #46: 0x089901de WebCore`WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1614
frame #47: 0x0898f541 WebCore`WebCore::RenderBlock::layout() + 81
frame #48: 0x08997837 WebCore`WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 711
frame #49: 0x08991b7b WebCore`WebCore::RenderBlock::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 587
frame #50: 0x089901f9 WebCore`WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1641
frame #51: 0x0898f541 WebCore`WebCore::RenderBlock::layout() + 81
frame #52: 0x08997837 WebCore`WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 711
frame #53: 0x08991b7b WebCore`WebCore::RenderBlock::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 587
frame #54: 0x089901f9 WebCore`WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1641
frame #55: 0x0898f541 WebCore`WebCore::RenderBlock::layout() + 81
frame #56: 0x08997837 WebCore`WebCore::RenderBlock::layoutBlockChild(WebCore::RenderBox*, WebCore::RenderBlock::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 711
frame #57: 0x08991b7b WebCore`WebCore::RenderBlock::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 587
frame #58: 0x089901f9 WebCore`WebCore::RenderBlock::layoutBlock(bool, WebCore::LayoutUnit) + 1641
frame #59: 0x0898f541 WebCore`WebCore::RenderBlock::layout() + 81
frame #60: 0x08af387e WebCore`WebCore::RenderView::layout() + 1374
frame #61: 0x08253531 WebCore`WebCore::FrameView::layout(bool) + 1713
frame #62: 0x080b0a64 WebCore`WebCore::Document::updateLayout() + 228
frame #63: 0x080b40fa WebCore`WebCore::Document::updateLayoutIgnorePendingStylesheets() + 298
frame #64: 0x0819a310 WebCore`WebCore::Element::offsetHeight() + 32
frame #65: 0x085a9534 WebCore`WebCore::jsElementOffsetHeight(JSC::ExecState*, JSC::JSValue, JSC::PropertyName) + 20
frame #66: 0x0a6ccb47 JavaScriptCore`JSC::JSValue::get(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&) const + 727
frame #67: 0x0a8eb309 JavaScriptCore`llint_slow_path_get_by_id + 233