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

Hot reloading error on windows #30

Open
puzzir opened this issue Jun 17, 2024 · 2 comments
Open

Hot reloading error on windows #30

puzzir opened this issue Jun 17, 2024 · 2 comments

Comments

@puzzir
Copy link

puzzir commented Jun 17, 2024

System information

Godot Engine v4.2.2.stable.official.15073afe3
Microsoft Windows NT 10.0.19045.0

Issue description

Godot editor crashes with error while recompiling library.

Steps to reproduce:

  1. Сompile the code and run Godot (with gd command).
package main

import (
	"grow.graphics/gd"
	"grow.graphics/gd/gdextension"
)

type NewLabel struct {
	gd.Class[NewLabel, gd.Label]
}

func main() {
	godot, ok := gdextension.Link()
	if !ok {
		return
	}
	gd.Register[NewLabel](godot)
}
  1. Add a new object "NewLabel" in the Godot editor via "Add Chid Node".

  2. With the editor running, recompile the library.

gd build

or

go build -o ./graphics/windows_amd64.dll -buildmode=c-shared

Then Godot editor crashes with error:

ERROR: Cannot get class ''.          
   at: (core/object/class_db.cpp:407)
panic: runtime.link/mmm error: use after free                                                                                
                                                                                                                             
goroutine 17 [running, locked to thread]:                                                                                    
grow.graphics/gd/gdextension.linkCGO.func80({{0x7ff85b0b2cf8?, 0xc0006c2000?}, 0x7ff85c4cc240?}, {{}, {0x6?, 0xc000624a50?}})
        D:/Golang/GOPATH/pkg/mod/grow.graphics/gd@v0.0.0-20240615231848-e0bdc0378103/gdextension/gdextension_interface.go:1755 +0x70
grow.graphics/gd.Engine(...)
        D:/Golang/GOPATH/pkg/mod/grow.graphics/gd@v0.0.0-20240615231848-e0bdc0378103/classdb.go:3643
grow.graphics/gd.(*instanceImplementation).Notification(0xc0001fa270, 0x3ea, 0xf8?)
        D:/Golang/GOPATH/pkg/mod/grow.graphics/gd@v0.0.0-20240615231848-e0bdc0378103/register_class.go:446 +0x63
grow.graphics/gd/gdextension.notification_func(0x0?, 0x3ea, 0x0)
        D:/Golang/GOPATH/pkg/mod/grow.graphics/gd@v0.0.0-20240615231848-e0bdc0378103/gdextension/gdextension_interface.go:2464 +0xa3
exit status 2
@Splizard
Copy link
Contributor

I'm not sure how solvable this is, Go doesn't strictly support dlclose when compiled to a shared library, so you get these weird inconsistent issues when you reload the extension. In my case, it works sometimes, other times, Godot will crash.

@Ullanar
Copy link

Ullanar commented Jun 25, 2024

Same here! But editor just closes silently. Without any additional logs

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

3 participants