Skip to content
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

[BUG] Crash when trying to resize the control. #813

Open
wsndshx opened this issue Aug 31, 2022 · 1 comment
Open

[BUG] Crash when trying to resize the control. #813

wsndshx opened this issue Aug 31, 2022 · 1 comment

Comments

@wsndshx
Copy link

wsndshx commented Aug 31, 2022

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
    image
  • 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/[email protected]/splitter.go:426
	 5  0x00000000005fe97a in github.com/lxn/walk.(*MouseEventPublisher).Publish
	     at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/[email protected]/mouseevent.go:69
	 6  0x00000000006579fc in github.com/lxn/walk.(*WindowBase).publishMouseEvent
	     at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/[email protected]/window.go:2054
	 7  0x000000000065a0c9 in github.com/lxn/walk.(*WindowBase).WndProc
	     at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/[email protected]/window.go:2382
	 8  0x0000000000616545 in github.com/lxn/walk.(*splitterHandle).WndProc
	     at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/[email protected]/splitterhandle.go:69
	 9  0x000000000065839e in github.com/lxn/walk.defaultWndProc
	     at C:/Users/zzlwd/go/pkg/mod/github.com/lxn/[email protected]/window.go:2159
	(truncated)

image

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
Copy link
Contributor

应该是你的代码逻辑问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants