-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebImage Instantly crashes on load when inside a TabView #133
Comments
I'm also getting a crash in iOS 14.0 within the SwiftUI AG Graph when a list item with a WebImage is scrolled onto screen |
Was it AGGraph::getValue()? I was experiencing that as well, but this bug was much easier to repro and track down. |
Need some dig into SwiftUI issue of this. I didn't realize that user will put this |
You can wrap that into a empty VStack or HStack. var body: some View {
TabView {
Text("testing")
.tabItem {
Text("test")
}
VStack {
WebImage(url: URL(string: "https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/SDWebImage_logo.png"))
}
.tabItem {
Text("test2")
}
}
} |
I've created a simple repro project that shows the crash I'm experiencing in lists and buttons in iOS 14.0 |
I'm also experiencing the AGGraph::getValue() crash but not inside a TabView. The images are in a SwiftUI List view. Wrapping them in an empty VStack or HStack didn't help. |
Yes, I had that problem as well |
Need some SwiftUI expert to help. This sounds like Apple's SwiftUI internal changes which effect the current WebImage implementation. |
I'm having a similar issue in a I'm not sure if this is a big in SwiftUI though or something that can be fixed with work arounds, etc. |
I'm also getting the same |
I'm also experiencing this issue. Did someone find a workaround or any info that could help? I'm happy to help even-though I'm not a SwiftUI expert. Here's my crash stack trace:
Thanks! |
@yonaskolb I have run your demo on |
The crash in List and Button (my sample project above) seems to be fixed in iOS 14.2 |
As for your crash @mjswen0923 (which is indeed not fixed in iOS 14.2) a workaround seems to be to wrap the TabView {
Text("testing")
.tabItem {
Text("test")
}
HStack {
WebImage(url: URL(string: "https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/SDWebImage_logo.png"))
}
.tabItem {
Text("test2")
}
} EDIT: I see now @dreampiggy already provided that solution above 😄 |
Any extra workaround without that Or can you have a try with other open source SwiftUI component to see whether they can used in KFImage: https://github.com/onevcat/Kingfisher/releases/tag/5.15.8 |
Saw an interesting reference to SwiftUI crashes in the Kingfisher release notes https://github.com/onevcat/Kingfisher/releases/tag/6.2.0 Not sure if the fix they implemented there helps things here, I haven't delved into how SDWebImage handles this, but might be interesting to look at onevcat/Kingfisher#1642 |
@yonaskolb We already don't use @State. Can't version 2.0 solve this issue ? Seems this issue is already stale. |
Oh, didn't see there was a release, will test and get back to you! |
Actually. TabView has some limitation for tabbar item:
You can use |
Looks like the same crash with List and Button is still present before iOS 14.2 with SDWebImageSwiftUI 2.0.1 |
Should be fixed in v2.0.2 However, I strongly recommended don't use Since the layout of |
When used inside a TabView, any loading of a WebImage will immediately cause a crash. Here is the code that causes the crash:
I am using Xcode 12.0 with iOS 14.0, with SDWebImage 5.9.0 and SDWebImageSwiftUI 1.5.0.
Below is the stack trace:
#0 0x00000001b30dcc64 in AG::AttributeID::size() const ()
#1 0x00000001b30d0b2c in AG::Graph::add_indirect_attribute(AG::Subgraph&, AG::AttributeID, unsigned long, std::__1::optional, bool) ()
#2 0x00000001b30e2fe8 in (anonymous namespace)::create_indirect_attribute(unsigned int, std::__1::optional) ()
#3 0x00000001926b5bf4 in partial apply for thunk for @callee_guaranteed () -> (@unowned IndirectAttribute) ()
#4 0x00000001926b5a24 in closure #1 in AGSubgraphRef.apply(_:) ()
#5 0x00000001926b5818 in Attribute.makeReusable(indirectMap:) ()
#6 0x00000001926b1fd0 in closure #1 in closure #1 in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#7 0x00000001923fd324 in closure #1 in closure #1 in PlaceholderInfo.makeItem(placeholder:seed:) ()
#8 0x0000000192525784 in thunk for @callee_guaranteed (@in_guaranteed _ViewInputs, @guaranteed @escaping @callee_guaranteed (@in_guaranteed _ViewInputs) -> (@out _ViewOutputs)) -> (@out _ViewOutputs?) ()
#9 0x00000001926ad49c in closure #1 in closure #1 in _ViewList_Elements.makeOneElement(at:inputs:indirectMap:body:) ()
#10 0x00000001926b7d58 in partial apply for thunk for @callee_guaranteed (@in_guaranteed _ViewInputs, @guaranteed @escaping @callee_guaranteed (@in_guaranteed _ViewInputs) -> (@out _ViewOutputs)) -> (@out _ViewOutputs?, @unowned Bool) ()
#11 0x00000001926b1e78 in closure #1 in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#12 0x00000001926b7d94 in partial apply for closure #1 in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#13 0x00000001926b7d58 in partial apply for thunk for @callee_guaranteed (@in_guaranteed _ViewInputs, @guaranteed @escaping @callee_guaranteed (@in_guaranteed _ViewInputs) -> (@out _ViewOutputs)) -> (@out _ViewOutputs?, @unowned Bool) ()
#14 0x00000001926b1e78 in closure #1 in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#15 0x00000001926b7d94 in partial apply for closure #1 in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#16 0x00000001926b7d58 in partial apply for thunk for @callee_guaranteed (@in_guaranteed _ViewInputs, @guaranteed @escaping @callee_guaranteed (@in_guaranteed _ViewInputs) -> (@out _ViewOutputs)) -> (@out _ViewOutputs?, @unowned Bool) ()
#17 0x00000001926b1e78 in closure #1 in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#18 0x00000001926b7d94 in partial apply for closure #1 in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#19 0x00000001926afe78 in UnaryElements.makeElements(from:inputs:indirectMap:body:) ()
#20 0x00000001926b3350 in SubgraphElements.makeElements(from:inputs:indirectMap:body:) ()
#21 0x00000001926b1d5c in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#22 0x00000001926b1c28 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#23 0x00000001926b1d5c in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#24 0x00000001926b1c28 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#25 0x00000001926b1d5c in closure #1 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#26 0x00000001926b1c28 in ModifiedElements.makeElements(from:inputs:indirectMap:body:) ()
#27 0x00000001926b3350 in SubgraphElements.makeElements(from:inputs:indirectMap:body:) ()
#28 0x00000001926ad420 in closure #1 in ViewList_Elements.makeOneElement(at:inputs:indirectMap:body:) ()
#29 0x00000001923fcedc in closure #1 in PlaceholderInfo.makeItem(placeholder:seed:) ()
#30 0x00000001923fc984 in PlaceholderInfo.updateValue() ()
#31 0x00000001920d83e4 in partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init(:) ()
#32 0x00000001b30cc194 in AG::Graph::UpdateStack::update() ()
#33 0x00000001b30cc5c8 in AG::Graph::update_attribute(AG::data::ptrAG::Node, bool) ()
#34 0x00000001b30d5728 in AG::Subgraph::update(unsigned int) ()
#35 0x0000000192738af4 in GraphHost.runTransaction() ()
#36 0x000000019224d780 in ViewGraph.updateOutputs(at:) ()
#37 0x000000019269604c in closure #1 in ViewRendererHost.render(interval:updateDisplayList:) ()
#38 0x0000000192695274 in ViewRendererHost.render(interval:updateDisplayList:) ()
#39 0x000000019214d748 in closure #1 in _UIHostingView.requestImmediateUpdate() ()
#40 0x0000000192801ec0 in thunk for @escaping @callee_guaranteed () -> () ()
#41 0x00000001050f3b68 in _dispatch_call_block_and_release ()
#42 0x00000001050f55f0 in _dispatch_client_callout ()
#43 0x0000000105104890 in dispatch_main_queue_callback_4CF ()
#44 0x000000018b9731e4 in CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE ()
#45 0x000000018b96d3b4 in __CFRunLoopRun ()
#46 0x000000018b96c4bc in CFRunLoopRunSpecific ()
#47 0x00000001a23f1820 in GSEventRunModal ()
#48 0x000000018e310734 in -[UIApplication run] ()
#49 0x000000018e315e10 in UIApplicationMain ()
#50 0x00000001926cd32c in closure #1 in KitRendererCommon(:) ()
#51 0x00000001926cd2b8 in runApp(:) ()
#52 0x0000000192246b08 in static App.main() ()
#53 0x0000000104c130b4 in static SDWebImageTestCrashApp.$main() ()
#54 0x0000000104c13154 in main ()
#55 0x000000018b633e60 in start ()
The text was updated successfully, but these errors were encountered: