You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working on the Editor branch, I noticed that when I return a Script instance from an overwritten method, that we crash due to a missing ref. A simple patch fixes this, but I am not sure that doing this to all codepaths that create an object by name is the right approach, or if this is only necessary on value returns (which only happen here).
diff --git a/Generator/Generator/ClassGen.swift b/Generator/Generator/ClassGen.swift
index a88b708..f5414eb 100644
--- a/Generator/Generator/ClassGen.swift
+++ b/Generator/Generator/ClassGen.swift
@@ -619,6 +619,12 @@ func processClass (cdef: JGodotExtensionAPIClass, outputDir: String) {
p ("/// Ths initializer is invoked by derived classes as they chain through their most derived type name that our framework produced")
p ("internal override init (name: StringName)") {
p("super.init (name: name)")
+ if (cdef.name == "RefCounted") {
+ p ("reference ()")
+ }
+ }
+ if cdef.name == "RefCounted" {
+ p ("deinit { print (\"RefCounted - deinit\") } ")
}
let fastInitOverrides = cdef.inherits != nil ? "override " : ""
The text was updated successfully, but these errors were encountered:
I suspect that the issue is that we are not retaining our own reference count when we return a value on a callback.
So perhaps the reference is only needed when we return those (we still have a table of live objects, but if our reference goes away, because the C++ takes ownership and drops the count, there is not much we can do).
When working on the Editor branch, I noticed that when I return a
Script
instance from an overwritten method, that we crash due to a missingref
. A simple patch fixes this, but I am not sure that doing this to all codepaths that create an object by name is the right approach, or if this is only necessary on value returns (which only happen here).The text was updated successfully, but these errors were encountered: