asticode / astilectron

Electron app that provides an API over a TCP socket that allows executing Electron's method as well as capturing Electron's events

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use second-instance, if lastWindow destroy, crash: Object has been destroyed

oldfeel opened this issue · comments

Can you provide a way to reproduce the problem?

Can you provide a way to reproduce the problem?

	// Initialize astilectron
	var a, _ = astilectron.New(log.New(os.Stderr, "", 0), astilectron.Options{
		SingleInstance: true,
		AppName:        "qocr",
	})
	defer a.Close()

	// Start astilectron
	a.Start()

	// Create a new window
	var w1, _ = a.NewWindow("http://127.0.0.1:4000", &astilectron.WindowOptions{
		Center: astikit.BoolPtr(true),
		Height: astikit.IntPtr(600),
		Width:  astikit.IntPtr(600),
	})
	w1.Create()

	// Create a new window
	var w2, _ = a.NewWindow("http://127.0.0.1:4000", &astilectron.WindowOptions{
		Center: astikit.BoolPtr(true),
		Height: astikit.IntPtr(600),
		Width:  astikit.IntPtr(600),
	})
	w2.Create()

	w2.Destroy()

	// Blocking pattern
	a.Wait()

Crash on the second run.

I've pushed a fix.

You need to get the latest changes for go-astilectron and (if you're using them) go-astilectron-bundler + go-astilectron-bootstrap.

In case you're using go-astilectron-bundler you need to run go install ./astilectron-bundler as well.

Can you confirm this is working properly?

It's OK, thank you very much!