Closed Endermanbugzjfc closed 2 years ago
Sorry for bothering you, I want to ask that how can I remove a row from a ui.Table element properly.
ui.Table
I tied to do ui.TableModel.RowDeleted(row) in a 10 seconds sleep goroutine but end up getting a weird:
ui.TableModel.RowDeleted(row)
2021-05-31 23:07:31.820 main[2489:61206] This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes. Stack:( 0 CoreAutoLayout 0x00007fff2717b47f _AssertAutoLayoutOnAllowedThreadsOnly + 189 1 CoreAutoLayout 0x00007fff2717b80f -[NSISEngine withBehaviors:performModifications:] + 25 2 AppKit 0x00007fff22c65869 -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 59 3 AppKit 0x00007fff22c6ebab -[NSView _setSuperview:] + 373 4 AppKit 0x00007fff22c96256 -[NSView removeFromSuperview] + 140 5 AppKit 0x00007fff22d15d26 -[NSView removeFromSuperviewWithoutNeedingDisplay] + 36 6 AppKit 0x00007fff22d7e7e2 -[NSTableRowData _removeViewAndAddToReuse:forRow:] + 885 7 AppKit 0x00007fff22d13dbb -[NSTableRowData _removeDeletedViews] + 1462 8 AppKit 0x00007fff22d125c4 -[NSTableRowData _updateVisibleViewsBasedOnUpdateItems] + 98 9 AppKit 0x00007fff22d12414 -[NSTableRowData _updateVisibleViewsBasedOnUpdateItemsAnimated] + 224 10 AppKit 0x00007fff22cf241b -[NSTableRowData _doWorkAfterEndUpdates] + 69 11 AppKit 0x00007fff22cf3d7e -[NSTableView _doUpdatedWorkWithHandler:] + 121 12 AppKit 0x00007fff22d7d07b -[NSTableView removeRowsAtIndexes:withAnimation:] + 142 13 main 0x00000000045a548d uiTableModelRowDeleted + 429 14 main 0x000000000406e0d0 runtime.asmcgocall + 112 ) 2021-05-31 23:07:31.855 main[2489:61206] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.' *** First throw call stack: ( 0 CoreFoundation 0x00007fff204c787b __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff201ffd92 objc_exception_throw + 48 2 CoreAutoLayout 0x00007fff2717b56d -[NSISEngine tryToOptimizeReturningMutuallyExclusiveConstraints] + 0 3 CoreAutoLayout 0x00007fff2717b80f -[NSISEngine withBehaviors:performModifications:] + 25 4 AppKit 0x00007fff22c65869 -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 59 5 AppKit 0x00007fff22c6ebab -[NSView _setSuperview:] + 373 6 AppKit 0x00007fff22c96256 -[NSView removeFromSuperview] + 140 7 AppKit 0x00007fff22d15d26 -[NSView removeFromSuperviewWithoutNeedingDisplay] + 36 8 AppKit 0x00007fff22d7e7e2 -[NSTableRowData _removeViewAndAddToReuse:forRow:] + 885 9 AppKit 0x00007fff22d13dbb -[NSTableRowData _removeDeletedViews] + 1462 10 AppKit 0x00007fff22d125c4 -[NSTableRowData _updateVisibleViewsBasedOnUpdateItems] + 98 11 AppKit 0x00007fff22d12414 -[NSTableRowData _updateVisibleViewsBasedOnUpdateItemsAnimated] + 224 12 AppKit 0x00007fff22cf241b -[NSTableRowData _doWorkAfterEndUpdates] + 69 13 AppKit 0x00007fff22cf3d7e -[NSTableView _doUpdatedWorkWithHandler:] + 121 14 AppKit 0x00007fff22d7d07b -[NSTableView removeRowsAtIndexes:withAnimation:] + 142 15 main 0x00000000045a548d uiTableModelRowDeleted + 429 16 main 0x000000000406e0d0 runtime.asmcgocall + 112 ) libc++abi: terminating with uncaught exception of type NSException SIGABRT: abort PC=0x7fff2032592e m=4 sigcode=0 goroutine 0 [idle]: runtime: unknown pc 0x7fff2032592e stack: frame={sp:0x70000a8e2638, fp:0x0} stack=[0x70000a863350,0x70000a8e2f50) 000070000a8e2538: 000070000a8e2900 0000000000000000 000070000a8e2548: 0000000004e9b000 000070000a8e2580 000070000a8e2558: 00007fff2017c727 0000000000000000 000070000a8e2568: 000070000a8e25a0 0000000000000001 000070000a8e2578: 0000000000000000 0000000032aaaba2 000070000a8e2588: 0000000000000000 0000000000000000 000070000a8e2598: 000070000a8e2760 0000000000000000 000070000a8e25a8: 0000000032aaaba2 000070000a8e25f0 000070000a8e25b8: 00007fff2026a15e 0000013c00001484 000070000a8e25c8: 000000000f0c5e00 00007fff80680ae8 000070000a8e25d8: 0000000000000011 0000000000000000 000070000a8e25e8: 00007fff8064d338 000070000a8e2620 000070000a8e25f8: 00007fff20262937 00007fff8064d338 000070000a8e2608: 00007fff80680ae8 00007fff20262896 000070000a8e2618: 0000000000000000 000070000a8e2660 000070000a8e2628: 00007fff202652c6 0000000000000000 000070000a8e2638: <00007fff203545bd 0000000000000003 000070000a8e2648: 00007fff80680ae0 000070000a8e2680 000070000a8e2658: 000070000a8e26b0 000070000a8e26a0 000070000a8e2668: 00007fff202a9411 0adbc1947c300045 000070000a8e2678: 000070000a8e2780 00007ffffffff9df 000070000a8e2688: ffffffff00000008 000070000a8e2780 000070000a8e2698: 00007fff2031afd1 000070000a8e27b0 000070000a8e26a8: 00007fff20317ef2 0000000000000000 000070000a8e26b8: 00007fff2031b02c 00007fff7b6d7065 000070000a8e26c8: 00007fff2021cc08 00007fff7b6d7070 000070000a8e26d8: ffffffffffffffc9 0000000000000000 000070000a8e26e8: 0000000000000000 0000000000000000 000070000a8e26f8: 0000000000000000 0000000000000000 000070000a8e2708: 0000000000000000 0000000000000000 000070000a8e2718: 0000000000000000 0000000000000000 000070000a8e2728: 0000000000000000 000070000a8e27b0 runtime: unknown pc 0x7fff2032592e stack: frame={sp:0x70000a8e2638, fp:0x0} stack=[0x70000a863350,0x70000a8e2f50) 000070000a8e2538: 000070000a8e2900 0000000000000000 000070000a8e2548: 0000000004e9b000 000070000a8e2580 000070000a8e2558: 00007fff2017c727 0000000000000000 000070000a8e2568: 000070000a8e25a0 0000000000000001 000070000a8e2578: 0000000000000000 0000000032aaaba2 000070000a8e2588: 0000000000000000 0000000000000000 000070000a8e2598: 000070000a8e2760 0000000000000000 000070000a8e25a8: 0000000032aaaba2 000070000a8e25f0 000070000a8e25b8: 00007fff2026a15e 0000013c00001484 000070000a8e25c8: 000000000f0c5e00 00007fff80680ae8 000070000a8e25d8: 0000000000000011 0000000000000000 000070000a8e25e8: 00007fff8064d338 000070000a8e2620 000070000a8e25f8: 00007fff20262937 00007fff8064d338 000070000a8e2608: 00007fff80680ae8 00007fff20262896 000070000a8e2618: 0000000000000000 000070000a8e2660 000070000a8e2628: 00007fff202652c6 0000000000000000 000070000a8e2638: <00007fff203545bd 0000000000000003 000070000a8e2648: 00007fff80680ae0 000070000a8e2680 000070000a8e2658: 000070000a8e26b0 000070000a8e26a0 000070000a8e2668: 00007fff202a9411 0adbc1947c300045 000070000a8e2678: 000070000a8e2780 00007ffffffff9df 000070000a8e2688: ffffffff00000008 000070000a8e2780 000070000a8e2698: 00007fff2031afd1 000070000a8e27b0 000070000a8e26a8: 00007fff20317ef2 0000000000000000 000070000a8e26b8: 00007fff2031b02c 00007fff7b6d7065 000070000a8e26c8: 00007fff2021cc08 00007fff7b6d7070 000070000a8e26d8: ffffffffffffffc9 0000000000000000 000070000a8e26e8: 0000000000000000 0000000000000000 000070000a8e26f8: 0000000000000000 0000000000000000 000070000a8e2708: 0000000000000000 0000000000000000 000070000a8e2718: 0000000000000000 0000000000000000 000070000a8e2728: 0000000000000000 000070000a8e27b0 goroutine 22 [syscall]: runtime.cgocall(0x4575a70, 0xc000055f20, 0x406fb00) /usr/local/go/src/runtime/cgocall.go:154 +0x5b fp=0xc000055ef0 sp=0xc000055eb8 pc=0x4005d1b github.com/andlabs/ui._Cfunc_uiTableModelRowDeleted(0x4f8b600, 0xc000000000) _cgo_gotypes.go:3654 +0x3c fp=0xc000055f20 sp=0xc000055ef0 pc=0x40fb8bc github.com/andlabs/ui.(*TableModel).RowDeleted.func1(0xc0008db4c0, 0x0) /Users/Eurus/go/pkg/mod/github.com/andlabs/ui@v0.0.0-20200610043537-70a69d6ae31e/tablemodel.go:224 +0x65 fp=0xc000055f58 sp=0xc000055f20 pc=0x4100785 github.com/andlabs/ui.(*TableModel).RowDeleted(0xc0008db4c0, 0x0) /Users/Eurus/go/pkg/mod/github.com/andlabs/ui@v0.0.0-20200610043537-70a69d6ae31e/tablemodel.go:224 +0x35 fp=0xc000055f78 sp=0xc000055f58 pc=0x40ff2b5 server/system.panelOverview.func3(0xc0008db4c0) /Users/Eurus/Documents/Development/DragonFly/EPICDL/system/control-panel.go:185 +0x4b fp=0xc000055fd8 sp=0xc000055f78 pc=0x456dfcb runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc000055fe0 sp=0xc000055fd8 pc=0x406e441 created by server/system.panelOverview /Users/Eurus/Documents/Development/DragonFly/EPICDL/system/control-panel.go:182 +0x38d goroutine 1 [syscall, locked to thread]: github.com/andlabs/ui._Cfunc_uiMain() _cgo_gotypes.go:2541 +0x3c github.com/andlabs/ui.Main(0x4715968, 0x4715068, 0x1) /Users/Eurus/go/pkg/mod/github.com/andlabs/ui@v0.0.0-20200610043537-70a69d6ae31e/main.go:41 +0x105 main.main() /Users/Eurus/Documents/Development/DragonFly/EPICDL/main.go:65 +0x57c goroutine 21 [chan receive]: main.main.func1() /Users/Eurus/Documents/Development/DragonFly/EPICDL/main.go:58 +0x35 created by main.main /Users/Eurus/Documents/Development/DragonFly/EPICDL/main.go:55 +0x56c rax 0x0 rbx 0x70000a8e3000 rcx 0x70000a8e2638 rdx 0x0 rdi 0x1103 rsi 0x6 rbp 0x70000a8e2660 rsp 0x70000a8e2638 r8 0x70000a8e2500 r9 0x0 r10 0x70000a8e3000 r11 0x246 r12 0x1103 r13 0x3000000008 r14 0x6 r15 0x16 rip 0x7fff2032592e rflags 0x246 cs 0x7 fs 0x0 gs 0x0 exit status 2
The error never occurs when I run the code before the main window show up.
Sorry for bothering you, I want to ask that how can I remove a row from a
ui.Table
element properly.I tied to do
ui.TableModel.RowDeleted(row)
in a 10 seconds sleep goroutine but end up getting a weird:The error never occurs when I run the code before the main window show up.