ModemManager[2804]: <warn> [1545055222.508649] No valid firmware images listed. Assuming firmware unsupported.
ModemManager[2804]: <debug> [1545055222.508665] firmware list loading failed: unsupported
ModemManager[2804]: <debug> [1545055222.508683] Couldn't load firmware image list: firmware list unknown
ModemManager[2804]: <debug> [1545055222.508728] Couldn't load current firmware image: current firmware unknown
(ModemManager:2804): GLib-CRITICAL **: 15:00:22.508: g_variant_builder_end: assertion '!GVSB(builder)->uniform_item_types || GVSB(builder)->prev_item_type != NULL || g_variant_type_is_definite (GVSB(builder)->type)' failed
Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff75b39b6 in ?? () from /usr/lib/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff75b39b6 in () at /usr/lib/libglib-2.0.so.0
#1 0x00007ffff75b4363 in g_logv () at /usr/lib/libglib-2.0.so.0
#2 0x00007ffff75b4560 in g_log () at /usr/lib/libglib-2.0.so.0
#3 0x00007ffff758867d in g_variant_builder_end () at /usr/lib/libglib-2.0.so.0
#4 0x00005555555e4d12 in load_current_ready (self=0x55555579c330, res=0x5555557388e0, ctx=0x5555557d6d80) at mm-iface-modem-firmware.c:84
#5 0x00007ffff778f194 in () at /usr/lib/libgio-2.0.so.0
#6 0x00007ffff778f1c9 in () at /usr/lib/libgio-2.0.so.0
#7 0x00007ffff75c4271 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#8 0x00007ffff75c5f89 in () at /usr/lib/libglib-2.0.so.0
#9 0x00007ffff75c6f62 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
#10 0x0000555555597aa0 in main (argc=2, argv=0x7fffffffe488) at main.c:181
Instead of assuming that NULL is a valid return, make sure we return
an error instead.
This also makes it sure that if the GTask gets cancelled, the result
we set is always a valid GObject, so that the g_object_unref passed as
GDestroyNotify can be safely called always. Not a big deal anyway, as
the GTask cannot be currently cancelled.
g_free and g_object_unref are in form of `void (*)(gpointer)`, which
matches the GDestroyNotify signature. An explicit GDestroyNotify cast on
g_free and g_object_unref is thus not needed.
The interfaces usually retrieve objects (e.g. skeletons) from the Modem object
using g_object_get(), but we didn't make sure that these objects were actually
valid before using them.
This should clean up errors happening when the modem gets unplugged and still
some actions are ongoing.
Should fix https://bugzilla.gnome.org/show_bug.cgi?id=685933