sciter-sdk / go-sciter

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

view.close() error #186

Closed christianruben closed 5 years ago

christianruben commented 5 years ago

i want to close window from tiscript with view.close() but i getting an error in console

pravic commented 5 years ago

What exactly error?

christianruben commented 5 years ago

fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]

runtime stack: runtime.throw(0x4e35b4, 0x2a) /usr/lib/go-1.10/src/runtime/panic.go:619 +0x81 runtime.sigpanic() /usr/lib/go-1.10/src/runtime/signal_unix.go:372 +0x28e

goroutine 1 [syscall]: runtime.cgocall(0x4a1110, 0xc420059f18, 0x0) /usr/lib/go-1.10/src/runtime/cgocall.go:128 +0x64 fp=0xc420059ee8 sp=0xc420059eb0 pc=0x4073c4 github.com/sciter-sdk/go-sciter/window._Cfunc_gtk_main() _cgo_gotypes.go:185 +0x41 fp=0xc420059f18 sp=0xc420059ee8 pc=0x49ca81 github.com/sciter-sdk/go-sciter/window.(*Window).Run(0xc4200801c0) /home/ben/go/src/github.com/sciter-sdk/go-sciter/window/window_linux.go:60 +0x20 fp=0xc420059f28 sp=0xc420059f18 pc=0x49cc80 main.main() /home/ben/go/src/project/calculator_sciter/src/calc.go:17 +0x10b fp=0xc420059f88 sp=0xc420059f28 pc=0x49d0db runtime.main() /usr/lib/go-1.10/src/runtime/proc.go:198 +0x212 fp=0xc420059fe0 sp=0xc420059f88 pc=0x42e382 runtime.goexit() /usr/lib/go-1.10/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420059fe8 sp=0xc420059fe0 pc=0x455c11 exit status 2

regiMario commented 5 years ago

I have a repro in case that helps. What's the workaround for this ATM?

sciter-go version: `commit 3bfb52764d8d380076f5dba8fa1a1b38796d27fa Author: golint fixer Date: Thu Oct 25 09:42:49 2018 -0500

Fix golint import path`

sciter-sdk version: `commit 1ac2e536d688b120a16da0b9d33159c3c86b4159 Author: Andrew Date: Sat Mar 16 08:59:44 2019 -0700

[+vlist] fix of the case when list.style["max-height"] == "max-content"`

go file:

package main import ("github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/window") func main() { rect := sciter.NewRect(0, 100, 860, 600) sciter.SetOption(sciter.SCITER_SET_SCRIPT_RUNTIME_FEATURES, sciter.ALLOW_FILE_IO|sciter.ALLOW_SOCKET_IO|sciter.ALLOW_EVAL| sciter.ALLOW_SYSINFO) windowflags := sciter.SW_TITLEBAR | sciter.SW_RESIZEABLE | sciter.SW_CONTROLS | sciter.SW_MAIN mainWin,_ := window.New(windowflags, rect) mainWin.LoadFile("test.html") mainWin.Show() mainWin.Run() }

test.html (s/</[/g to work around githubs broken code quoting): [html>[head> [script type="text/tiscript"> $(#btnTest).on("click", function () {view.window {url: self.url("crash.html")};}); </script> [/head><body> [button#btnTest>Test</button></body></html>

crash.html (s/</[/g to work around githubs broken code quoting): [html>[head> [script type="text/tiscript" > $(#btnCrash).on("click", function () { view.close(); }); </script></head><body> [button#btnCrash>Crash</button> [/body></html>

With everything in the same folder running (adjust env vars as needed): $ GOROOT=/usr/local/go GOPATH=~/src/includes/go go build -o test test.go && ./test

Get the following: `fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7f599e5a0be6]

runtime stack: runtime.throw(0x4e4a0f, 0x2a) /usr/local/go/src/runtime/panic.go:608 +0x72 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:374 +0x2f2

goroutine 1 [syscall]: runtime.cgocall(0x4a3650, 0xc000036740, 0x0) /usr/local/go/src/runtime/cgocall.go:128 +0x5e fp=0xc000036710 sp=0xc0000366d8 pc=0x40859e github.com/sciter-sdk/go-sciter/window._Cfunc_gtk_main() _cgo_gotypes.go:190 +0x41 fp=0xc000036740 sp=0xc000036710 pc=0x49f011 github.com/sciter-sdk/go-sciter/window.(*Window).Run(0xc0000781c0) /d2/home/mario/src/includes/go/src/github.com/sciter-sdk/go-sciter/window/window_linux.go:60 +0x20 fp=0xc000036750 sp=0xc000036740 pc=0x49f210 main.main() /d2/home/mario/src/apps/box/src/test.go:20 +0xc1 fp=0xc000036798 sp=0xc000036750 pc=0x49f611 runtime.main() /usr/local/go/src/runtime/proc.go:201 +0x207 fp=0xc0000367e0 sp=0xc000036798 pc=0x42f157 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc0000367e8 sp=0xc0000367e0 pc=0x457521`

Platform info: $ uname -a Linux kdev.de.regify.com 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/issue Ubuntu 16.04.6 LTS \n \l

pravic commented 5 years ago

cc @c-smile Does this ring any bells?

pravic commented 5 years ago

Ah, I see it's discussed here already https://sciter.com/forums/topic/view-close-on-gtk-crash/