[PATCH] broadband-modem-huawei: implement Modem.Signal extended signal info interface
Dan Williams
dcbw at redhat.com
Mon Aug 29 15:33:39 UTC 2016
On Mon, 2016-08-29 at 11:44 +0200, Aleksander Morgado wrote:
> Hey,
>
> I couldn't apply this patch on top of git master with "git am", not
> sure why.
>
> Anyway, some minor things below; please push yourself once fixed,
>
> Cheers!
>
> On Fri, Aug 19, 2016 at 11:58 PM, Dan Williams <dcbw at redhat.com>
> wrote:
> > +static gboolean
> > +signal_load_values_finish (MMIfaceModemSignal *self,
> > + GAsyncResult *res,
> > + MMSignal **cdma,
> > + MMSignal **evdo,
> > + MMSignal **gsm,
> > + MMSignal **umts,
> > + MMSignal **lte,
> > + GError **error)
> > +{
> > + DetailedSignal *values_result;
> > +
> > + values_result = g_task_propagate_pointer (G_TASK (res),
> > error);
> > + if (!values_result)
> > + return FALSE;
> > +
> > + /* References from hcsq_get_ready() transferred to caller so
> > we don't
> > + * need to unref them elsewhere.
> > + */
> > + *cdma = values_result->cdma;
> > + *evdo = values_result->evdo;
> > + *gsm = values_result->gsm;
> > + *umts = values_result->umts;
> > + *lte = values_result->lte;
> "values_result" leaks here.
Actually it shouldn't due to the magic of GTask, because:
> >
> > + values_result = g_slice_new0 (DetailedSignal);
> > + values_result->cdma = self->priv->detailed_signal.cdma ?
> > g_object_ref (self->priv->detailed_signal.cdma) : NULL;
> > + values_result->evdo = self->priv->detailed_signal.evdo ?
> > g_object_ref (self->priv->detailed_signal.evdo) : NULL;
> > + values_result->gsm = self->priv->detailed_signal.gsm ?
> > g_object_ref (self->priv->detailed_signal.gsm) : NULL;
> > + values_result->umts = self->priv->detailed_signal.umts ?
> > g_object_ref (self->priv->detailed_signal.umts) : NULL;
> > + values_result->lte = self->priv->detailed_signal.lte ?
> > g_object_ref (self->priv->detailed_signal.lte) : NULL;
> > +
> > + g_task_return_pointer (task, values_result,
> > (GDestroyNotify)detailed_signal_free);
> > + g_object_unref (task);
The detailed_signal_free() on the task pointer should free
values_result when the GTask is destroyed. This is the first GTask
conversion I've done though, so does that look like it handles the
cleanup correctly?
Dan
More information about the ModemManager-devel
mailing list