sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.58k stars 268 forks source link

Unhandled sciter event case: 32768 cause panic in windows 10 #239

Closed Exploiterigoer closed 4 years ago

Exploiterigoer commented 4 years ago

err1 err2 err3

Here is my code:

// handling callback for element event
func (dom *DomOpt) SetElementHandlers() {
    // handling for btn1
    btn1, _ := dom.Root.SelectById("btn1")
    btn1.DefineMethod("btn1ClickHandler", func(args ...*sciter.Value) *sciter.Value {
        for _, arg := range args {
            fmt.Print(arg.String() + " ")
        }
        return sciter.NullValue()
    })

    // handling for btn2
    btn2, _ := dom.Root.SelectById("btn2")
    data, _ := btn2.CallMethod("btn2ClickHandler",
        sciter.NewValue("1"),
        sciter.NewValue("2"),
        sciter.NewValue("3"))

    fmt.Println(data.String())
}

It works when doing comment in sciter.go:

// log.Panic("Unhandled sciter event case: ", evtg)

katro@DESKTOP-U6Q7AN4 MINGW32 /d/workspace/gopro/gui $ ./mixure.exe function def of btn2--->test2 "1" "2" "3" 2020/06/21 23:33:28 Unhandled sciter event case: 32768 panic: Unhandled sciter event case: 32768

goroutine 1 [running]: log.Panic(0xc000087bc8, 0x2, 0x2) D:/devenv/go/src/log/log.go:351 +0xb3 github.com/sciter-sdk/go-sciter.goElementEventProc(0x0, 0x0, 0x8000, 0xb9ec50, 0x38) D:/devenv/golib/pkg/mod/github.com/sciter-sdk/go-sciter@v0.5.0/sciter.go:1468 +0x300 github.com/sciter-sdk/go-sciter._cgoexpwrap_a267971ed125_goElementEventProc(0x0, 0x0, 0x8000, 0xb9ec50, 0xb9ed90) _cgo_gotypes.go:2030 +0x50 syscall.Syscall(0x7ff8488943a0, 0x2, 0x5c0818, 0x5, 0x0, 0x0, 0x0, 0x0) D:/devenv/go/src/runtime/syscall_windows.go:188 +0xe9 github.com/lxn/win.ShowWindow(0x5c0818, 0xc000000005, 0xc00000a640) D:/devenv/golib/pkg/mod/github.com/lxn/win@v0.0.0-20191128105842-2da648fda5b4/user32.go:3273 +0x6a github.com/sciter-sdk/go-sciter/window.(*Window).Show(0xc00003ed70) D:/devenv/golib/pkg/mod/github.com/sciter-sdk/go-sciter@v0.5.0/window/window_windows.go:42 +0x45 main.main() D:/workspace/gopro/gui/main.go:100 +0x3d2

pravic commented 4 years ago

https://github.com/sciter-sdk/go-sciter/commit/ce0e920fd2fb79974c2cc202242fba2f774559c0 has been fixed already

Exploiterigoer commented 4 years ago

@pravic When pulling the latest commited code,it fails.Is there something missing for me?

err4 err5

pravic commented 4 years ago

It's strange because it's tested on different Go versions with Travis. Though you're on Windows. I'll check.

Exploiterigoer commented 4 years ago

It works when using this commits 89a4dd09b0f8f79e35169e476df73347d21f9797 2020-08-02 210136

dzcpy commented 4 years ago

Still got this error with latest code on master: image

Exploiterigoer commented 4 years ago

@dzcpy Obviously,you use an old version. image

dzcpy commented 4 years ago

@Exploiterigoer Thanks for your kind reply. I'm new to Go, could you please elaborate a bit on how did you update the module? I tried to clone it into go/kg/mod, but it still uses v0.5.0

Exploiterigoer commented 4 years ago

@dzcpy In the go.mod,following this,and then, run go build . or go get . in the terminal

module com.gui/07

go 1.14

require (
    github.com/lxn/win v0.0.0-20191128105842-2da648fda5b4 // indirect
    github.com/sciter-sdk/go-sciter 89a4dd09b0f8f79e35169e476df73347d21f9797
)

2020-08-18 225914

icedcoke commented 3 years ago

perfect, the problem is solved. thx