Commit 863ea335 authored by Torsten Schönfeld's avatar Torsten Schönfeld

Avoid repeating setting up a library

This can lead to issues, e.g., due to types being registered more than once
with perl-Glib.  In particular, the lazy-loading mechanism of Glib::Object is
not prepared to handle repeated type registrations.
parent b191fcbe
Overview of changes in Glib::Object::Introspection <next>
========================================================
* Avoid repeating setting up a library as this can lead to issues.
Overview of changes in Glib::Object::Introspection 0.029
========================================================
......
......@@ -47,7 +47,7 @@ generic_class_init (GIObjectInfo *info, const gchar *target_package, gpointer cl
* struct member. */
HV * stash = gv_stashpv (target_package, 0);
GV * slot = gv_fetchmethod (stash, perl_method_name);
if (!slot) {
if (!slot || !GvCV (slot)) {
dwarn ("skipping vfunc %s.%s because it has no implementation\n",
g_base_info_get_name (info), vfunc_name);
g_base_info_unref (vfunc_info);
......
......@@ -28,6 +28,7 @@ require XSLoader;
XSLoader::load(__PACKAGE__, $VERSION);
my @OBJECT_PACKAGES_WITH_VFUNCS;
my %SEEN;
our %_FORBIDDEN_SUB_NAMES = map { $_ => 1 } qw/AUTOLOAD CLONE DESTROY BEGIN
UNITCHECK CHECK INIT END/;
our %_BASENAME_TO_PACKAGE;
......@@ -68,6 +69,14 @@ sub setup {
my $search_path = $params{search_path} || undef;
my $name_corrections = $params{name_corrections} || {};
# Avoid repeating setting up a library as this can lead to issues, e.g., due
# to types being registered more than once with perl-Glib. In particular,
# the lazy-loading mechanism of Glib::Object is not prepared to handle
# repeated type registrations.
if ($SEEN{$basename}{$version}{$package}++) {
return;
}
$_BASENAME_TO_PACKAGE{$basename} = $package;
my %shift_package_name_for = exists $params{class_static_methods}
......@@ -177,9 +186,11 @@ sub setup {
foreach my $packaged_signal (@use_generic_signal_marshaller_for) {
__PACKAGE__->_use_generic_signal_marshaller_for (@$packaged_signal);
}
return;
}
sub INIT {
INIT {
no strict qw(refs);
# Hook up the implemented vfuncs first.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment