[BUG] Crash when trying to resize the control.
wsndshx opened this issue · 1 comments
wsndshx commented
What I did:
- Write a file
- Debug and run the program
- At the beginning the program works fine
- But when I move the mouse to the bottom of the
TableView
and find that I can adjust the height at this point, I click the mouse and drag it up and down
- There is a crash
Crash message:
"runtime error: invalid memory address or nil pointer dereference"
Stack:
4 0x0000000000614d3f in github.com/lxn/walk.(*Splitter).onInsertedWidget.func3.3
at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/walk@v0.0.0-20210112085537-c389da54e794/splitter.go:426
5 0x00000000005fe97a in github.com/lxn/walk.(*MouseEventPublisher).Publish
at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/walk@v0.0.0-20210112085537-c389da54e794/mouseevent.go:69
6 0x00000000006579fc in github.com/lxn/walk.(*WindowBase).publishMouseEvent
at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/walk@v0.0.0-20210112085537-c389da54e794/window.go:2054
7 0x000000000065a0c9 in github.com/lxn/walk.(*WindowBase).WndProc
at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/walk@v0.0.0-20210112085537-c389da54e794/window.go:2382
8 0x0000000000616545 in github.com/lxn/walk.(*splitterHandle).WndProc
at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/walk@v0.0.0-20210112085537-c389da54e794/splitterhandle.go:69
9 0x000000000065839e in github.com/lxn/walk.defaultWndProc
at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/walk@v0.0.0-20210112085537-c389da54e794/window.go:2159
(truncated)
My question:
Is it because I'm dragging the bottom element, causing the bottom element to be larger than the program can display? Or is it related to this issue #597?
My Code
func mainWin() {
var mainwin *walk.MainWindow
mw := &CondomMainWindow{model: NewCondomModel()}
if err := (MainWindow{
AssignTo: &mainwin,
Size: Size{Width: 800, Height: 100},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
VSplitter{
Children: []Widget{
GroupBox{
Layout: HBox{},
Title: "应用设置",
Children: []Widget{
LinkLabel{
Text: "频率:",
},
NumberEdit{
MinSize: Size{Width: 20},
MaxSize: Size{Width: 30},
MinValue: 10,
MaxValue: 120,
},
LinkLabel{
Text: "秒",
},
HSpacer{},
},
},
TableView{
MaxSize: Size{Height: 300},
MinSize: Size{Width: 450},
AssignTo: &mw.tv,
// CheckBoxes: true,
ColumnsOrderable: true,
// MultiSelection: true,
Columns: []TableViewColumn{
// ......
},
Model: mw.model,
},
VSpacer{},
},
},
},
},
},
}).Create(); err != nil {
log.Fatal(err)
}
mainwin.Run()
}
iquanxin commented
应该是你的代码逻辑问题