Commit 7190c5024d introduced the usage of new GObject define macros with
private. However as the conversion hasn't been done for abstract types
(G_DEFINE_ABSTRACT_TYPE) and the addition of the private classes for the
abstract types has been removed as part of the commit, crashes can be
seen in Apps consuming libvirt-glib, as this one from GNOME Boxes:
Thread 1 "gnome-boxes" received signal SIGSEGV, Segmentation fault.
0x00007ffff7ef2b35 in g_type_check_instance_is_fundamentally_a () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
(gdb) bt
#0 0x00007ffff7ef2b35 in g_type_check_instance_is_fundamentally_a () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#1 0x00007ffff7ed2e75 in g_object_unref () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#2 0x00007ffff6ef094e in gvir_domain_device_set_property (object=0x555556680950,
prop_id=2, value=0x7fffffffcbe0,
pspec=0x555556772540) at libvirt-gobject-domain-device.c:89
#3 0x00007ffff7ed3b19 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4 0x00007ffff7ed5624 in g_object_new_valist () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007ffff7ed5959 in g_object_new () from
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6 0x00005555555d8257 in boxes_libvirt_machine_get_domain_disk (self=0x5555560e6790,
error=0x55555615a630)
at /run/build/gnome-boxes/src/libvirt-machine.vala:547
#7 0x00005555555d0e7e in boxes_libvirt_machine_update_io_stat_co
(_data_=0x55555615a320)
at /run/build/gnome-boxes/src/libvirt-machine.vala:280
#8 0x00005555555d09b2 in boxes_libvirt_machine_update_io_stat (self=0x5555560e6790,
info=0x555555f25990, stat=0x555556736a90,
_callback_=0x5555555d2992 <boxes_libvirt_machine_update_stats_ready>,
_user_data_=0x555556736a50)
at /run/build/gnome-boxes/src/libvirt-machine.vala:5
#9 0x00005555555d3120 in boxes_libvirt_machine_update_stats_co (_data_=0x555556736a50)
at /run/build/gnome-boxes/src/libvirt-machine.vala:332
#10 0x00005555555d29dd in boxes_libvirt_machine_update_stats_ready
(source_object=0x5555567bb840, _res_=0x55555677ae00,
_user_data_=0x555556736a50) at /run/build/gnome-boxes/src/libvirt-machine.vala:328
#11 0x00007ffff72adc89 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#12 0x00007ffff72adcc9 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#13 0x00007ffff7dec948 in g_main_context_dispatch () from
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff7decd38 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff7decdcc in g_main_context_iteration () from
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff72c2dbd in g_application_run () from
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#17 0x00005555556004b6 in _vala_main (args=0x7fffffffd4f8, args_length1=1) at
/run/build/gnome-boxes/src/main.vala:84
#18 0x0000555555600517 in main (argc=1, argv=0x7fffffffd4f8) at
/run/build/gnome-boxes/src/main.vala:68
In order to solve the issue, let's just replace G_DEFINE_ABSTRACT_TYPE
by G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE.
Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
libvirt-gconfig/libvirt-gconfig-domain-address.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-chardev-source.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-chardev.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-controller.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-graphics.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-hostdev.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-interface.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-smartcard.c | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-timer.c | 2 +-
libvirt-gobject/libvirt-gobject-domain-device.c | 2 +-
10 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address.c
b/libvirt-gconfig/libvirt-gconfig-domain-address.c
index b070a1f..a9eefd8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-address.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-address.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainAddressPrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainAddress, gvir_config_domain_address,
GVIR_CONFIG_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainAddress, gvir_config_domain_address,
GVIR_CONFIG_TYPE_OBJECT);
static void gvir_config_domain_address_class_init(GVirConfigDomainAddressClass *klass
G_GNUC_UNUSED)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source.c
b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source.c
index 50d4030..fe22290 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-chardev-source.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev-source.c
@@ -34,7 +34,7 @@ struct _GVirConfigDomainChardevSourcePrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainChardevSource, gvir_config_domain_chardev_source,
GVIR_CONFIG_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainChardevSource,
gvir_config_domain_chardev_source, GVIR_CONFIG_TYPE_OBJECT);
static void
gvir_config_domain_chardev_source_class_init(GVirConfigDomainChardevSourceClass *klass
G_GNUC_UNUSED)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-chardev.c
b/libvirt-gconfig/libvirt-gconfig-domain-chardev.c
index a5ebc9c..aa7e3e9 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-chardev.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-chardev.c
@@ -34,7 +34,7 @@ struct _GVirConfigDomainChardevPrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainChardev, gvir_config_domain_chardev,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainChardev, gvir_config_domain_chardev,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE)
static void gvir_config_domain_chardev_class_init(GVirConfigDomainChardevClass *klass
G_GNUC_UNUSED)
{
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-controller.c
b/libvirt-gconfig/libvirt-gconfig-domain-controller.c
index a2d40c3..0c880f8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-controller.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-controller.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainControllerPrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainController, gvir_config_domain_controller,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainController,
gvir_config_domain_controller, GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
static void gvir_config_domain_controller_class_init(GVirConfigDomainControllerClass
*klass G_GNUC_UNUSED)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
index e35976f..8c24adc 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainGraphicsPrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainGraphics, gvir_config_domain_graphics,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainGraphics,
gvir_config_domain_graphics, GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
static void gvir_config_domain_graphics_class_init(GVirConfigDomainGraphicsClass *klass
G_GNUC_UNUSED)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-hostdev.c
b/libvirt-gconfig/libvirt-gconfig-domain-hostdev.c
index ade2dc3..465490e 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-hostdev.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-hostdev.c
@@ -34,7 +34,7 @@ struct _GVirConfigDomainHostdevPrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainHostdev, gvir_config_domain_hostdev,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainHostdev, gvir_config_domain_hostdev,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
static void gvir_config_domain_hostdev_class_init(GVirConfigDomainHostdevClass *klass
G_GNUC_UNUSED)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
index 2b841b3..7c5c8e4 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
@@ -35,7 +35,7 @@ struct _GVirConfigDomainInterfacePrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainInterface, gvir_config_domain_interface,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainInterface,
gvir_config_domain_interface, GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
static void gvir_config_domain_interface_class_init(GVirConfigDomainInterfaceClass *klass
G_GNUC_UNUSED)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-smartcard.c
b/libvirt-gconfig/libvirt-gconfig-domain-smartcard.c
index f7c65f0..0d000e7 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-smartcard.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-smartcard.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainSmartcardPrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainSmartcard, gvir_config_domain_smartcard,
GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainSmartcard,
gvir_config_domain_smartcard, GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
static void gvir_config_domain_smartcard_class_init(GVirConfigDomainSmartcardClass *klass
G_GNUC_UNUSED)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.c
b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
index f33a56f..d6d98dd 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainTimerPrivate
gboolean unused;
};
-G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainTimer, gvir_config_domain_timer,
GVIR_CONFIG_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainTimer, gvir_config_domain_timer,
GVIR_CONFIG_TYPE_OBJECT);
static void gvir_config_domain_timer_class_init(GVirConfigDomainTimerClass *klass
G_GNUC_UNUSED)
diff --git a/libvirt-gobject/libvirt-gobject-domain-device.c
b/libvirt-gobject/libvirt-gobject-domain-device.c
index 4ed846c..ce199c5 100644
--- a/libvirt-gobject/libvirt-gobject-domain-device.c
+++ b/libvirt-gobject/libvirt-gobject-domain-device.c
@@ -40,7 +40,7 @@ struct _GVirDomainDevicePrivate
GVirConfigDomainDevice *config;
};
-G_DEFINE_ABSTRACT_TYPE(GVirDomainDevice, gvir_domain_device, G_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirDomainDevice, gvir_domain_device,
G_TYPE_OBJECT);
enum {
PROP_0,
--
2.19.0