Fix crashing when removing items from ForEach
Some checks failed
Deploy Docs / publish (push) Has been cancelled
SwiftLint / SwiftLint (push) Has been cancelled

This commit is contained in:
david-swift 2025-09-03 13:35:29 +02:00
parent ebb2455fe1
commit 0d4db96f60

View File

@ -61,7 +61,6 @@ public struct ForEach<Element>: AdwaitaWidget where Element: Identifiable {
functions: .init { index in functions: .init { index in
let child = contentStorage[safe: index]?.opaquePointer let child = contentStorage[safe: index]?.opaquePointer
gtk_box_remove(widget, child?.cast()) gtk_box_remove(widget, child?.cast())
g_object_unref(child?.cast())
contentStorage.remove(at: index) contentStorage.remove(at: index)
} insert: { index, element in } insert: { index, element in
let child = content(element).storage(data: data, type: type) let child = content(element).storage(data: data, type: type)