Skip to content
Snippets Groups Projects

port-qmi: avoid running install_properties() without properties defined

1 file
+ 16
17
Compare changes
  • Side-by-side
  • Inline
  • We'll setup the properties only if QRTR support is being built,
    otherwise we fully skip all property related setup.
    
      (ModemManager:480463): GLib-GObject-CRITICAL **: 22:48:14.264: g_object_class_install_properties: assertion 'n_pspecs > 1' failed
    
      Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
      0x00007ffff76e3295 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
      (gdb) bt
      #0  0x00007ffff76e3295 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #1  0x00007ffff76e4579 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #2  0x00007ffff76e4743 in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #3  0x00005555556af70c in mm_port_qmi_class_init (klass=0x5555557fae20) at mm-port-qmi.c:2619
      #4  0x00005555556a94c3 in mm_port_qmi_class_intern_init (klass=0x5555557fae20) at mm-port-qmi.c:34
      #5  0x00007ffff77ed1d1 in g_type_class_ref () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
      #6  0x00007ffff77d05e1 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
      #7  0x00007ffff77d06cd in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
      #8  0x00005555556af25a in mm_port_qmi_new (name=0x5555557e54e0 "cdc-wdm0", subsys=MM_PORT_SUBSYS_USBMISC) at mm-port-qmi.c:2481
      #9  0x000055555563c8d7 in wdm_probe_qmi (self=0x5555557de1b0) at mm-port-probe.c:517
      #10 0x000055555563cc70 in wdm_probe (self=0x5555557de1b0) at mm-port-probe.c:623
      #11 0x00007ffff76dd04e in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #12 0x00007ffff76dd400 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #13 0x00007ffff76dd6f3 in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
      #14 0x00005555555b1ae4 in main (argc=1, argv=0x7fffffffe558) at main.c:213
+ 16
17
@@ -33,16 +33,18 @@
G_DEFINE_TYPE (MMPortQmi, mm_port_qmi, MM_TYPE_PORT)
#if defined WITH_QRTR
enum {
PROP_0,
#if defined WITH_QRTR
PROP_NODE,
#endif
PROP_LAST
};
static GParamSpec *properties[PROP_LAST];
#endif
typedef struct {
QmiService service;
QmiClient *client;
@@ -2511,23 +2513,21 @@ mm_port_qmi_init (MMPortQmi *self)
NULL);
}
#if defined WITH_QRTR
static void
set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MMPortQmi *self = MM_PORT_QMI (object);
switch (prop_id) {
#if defined WITH_QRTR
case PROP_NODE:
{
MMPortQmi *self = MM_PORT_QMI (object);
/* construct only, no new reference! */
self->priv->node = g_value_get_object (value);
break;
}
#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2540,22 +2540,20 @@ get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
MMPortQmi *self = MM_PORT_QMI (object);
switch (prop_id) {
#if defined WITH_QRTR
case PROP_NODE:
{
MMPortQmi *self = MM_PORT_QMI (object);
g_value_set_object (value, self->priv->node);
break;
}
#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
#endif /* defined WITH_QRTR */
static void
dispose (GObject *object)
{
@@ -2603,11 +2601,12 @@ mm_port_qmi_class_init (MMPortQmiClass *klass)
g_type_class_add_private (object_class, sizeof (MMPortQmiPrivate));
/* Virtual methods */
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->dispose = dispose;
#if defined WITH_QRTR
object_class->get_property = get_property;
object_class->set_property = set_property;
properties[PROP_NODE] =
g_param_spec_object ("node",
"Qrtr Node",
@@ -2615,6 +2614,6 @@ mm_port_qmi_class_init (MMPortQmiClass *klass)
QRTR_TYPE_NODE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
#endif
g_object_class_install_properties (object_class, PROP_LAST, properties);
#endif
}
Loading