`intern` returned as `GObject::ParamSpec`s `object.type_init`
BlobCodes opened this issue · 1 comments
BlobCodes commented
The following code:
class Test < GObject::ParamSpec
end
Causes a linker error:
/usr/bin/ld: T-est.o: in function `g_type':
/var/mnt/media/Projects/Other/mangaba/lib/gtk4/lib/gi-crystal/src/auto/g_object-2.0/param_spec.cr:73: undefined reference to `intern'
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /var/home/blobcodes/.cache/crystal/crystal-run-test2.tmp -rdynamic -L/usr/lib64/crystal -lgtk-4 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgobject-2.0 -lglib-2.0 -lglib-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lm -lgc -lpthread -levent -lrt -lpthread -ldl`
This is because object.type_init
returns the string "internal" for GObject::ParamSpec
, leading to this code:
# Returns the type id (GType) registered in GLib type system.
def self.g_type : UInt64
LibGObject.intern
end
AFAICT this seems to be a special value, in which case there should just be a compiler error.
I have no real use-case where this matters but this issue could show errors in the cooperation with gobject-introspection
.
hugopl commented
the problem is that gobject introspection returns a lot of bad information for ParamSpec, so I think the easier way to fix that is adding a include file for ParamSpec that disallow inheritance.