<div dir="ltr">btw, the g_list_free_full implementation seems to handle a NULL GList argument, but the glib doc doesn't explicitly mention that.  I wonder if it's better to add `if (glist_ptr)` check anyway. </div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 28, 2017 at 11:23 PM, Ben Chan <span dir="ltr"><<a href="mailto:benchan@chromium.org" target="_blank">benchan@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When calling g_list_free_full() to free a GList in dispose(), it is<br>
necessary to reset the GList pointer to NULL as dispose() may be called<br>
more than once.<br>
---<br>
 src/mm-call-list.c | 1 +<br>
 src/mm-device.c    | 2 ++<br>
 src/mm-sms-list.c  | 1 +<br>
 3 files changed, 4 insertions(+)<br>
<br>
diff --git a/src/mm-call-list.c b/src/mm-call-list.c<br>
index e829ae7b..fae66035 100644<br>
--- a/src/mm-call-list.c<br>
+++ b/src/mm-call-list.c<br>
@@ -395,6 +395,7 @@ dispose (GObject *object)<br>
<br>
     g_clear_object (&self->priv->modem);<br>
     g_list_free_full (self->priv->list, g_object_unref);<br>
+    self->priv->list = NULL;<br>
<br>
     G_OBJECT_CLASS (mm_call_list_parent_class)-><wbr>dispose (object);<br>
 }<br>
diff --git a/src/mm-device.c b/src/mm-device.c<br>
index aa7a27e0..1b69f3de 100644<br>
--- a/src/mm-device.c<br>
+++ b/src/mm-device.c<br>
@@ -647,7 +647,9 @@ dispose (GObject *object)<br>
<br>
     g_clear_object (&(self->priv->plugin));<br>
     g_list_free_full (self->priv->port_probes, g_object_unref);<br>
+    self->priv->port_probes = NULL;<br>
     g_list_free_full (self->priv->ignored_port_<wbr>probes, g_object_unref);<br>
+    self->priv->ignored_port_<wbr>probes = NULL;<br>
<br>
     clear_modem (self);<br>
<br>
diff --git a/src/mm-sms-list.c b/src/mm-sms-list.c<br>
index 03daaf24..7819b3ad 100644<br>
--- a/src/mm-sms-list.c<br>
+++ b/src/mm-sms-list.c<br>
@@ -451,6 +451,7 @@ dispose (GObject *object)<br>
<br>
     g_clear_object (&self->priv->modem);<br>
     g_list_free_full (self->priv->list, g_object_unref);<br>
+    self->priv->list = NULL;<br>
<br>
     G_OBJECT_CLASS (mm_sms_list_parent_class)-><wbr>dispose (object);<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.12.2.564.g063fe858b8-goog<br>
<br>
______________________________<wbr>_________________<br>
ModemManager-devel mailing list<br>
<a href="mailto:ModemManager-devel@lists.freedesktop.org">ModemManager-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/modemmanager-<wbr>devel</a><br>
</font></span></blockquote></div><br></div>