plugin: don't use internal task list to cancel AT probing in other probes

This commit is contained in:
Aleksander Morgado
2012-07-10 13:11:01 +02:00
parent 61e285497c
commit d84cecac99

View File

@@ -360,19 +360,9 @@ typedef struct {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
MMPlugin *plugin; MMPlugin *plugin;
MMPortProbeFlag flags; MMPortProbeFlag flags;
MMDevice *device;
} PortProbeRunContext; } PortProbeRunContext;
static void
cancel_at_probing_in_other_probes (const gchar *key,
MMPortProbe *other,
MMPortProbe *self)
{
if (self != other &&
g_str_equal (mm_port_probe_get_port_physdev (self),
mm_port_probe_get_port_physdev (other)))
mm_port_probe_run_cancel_at_probing (other);
}
static void static void
port_probe_run_ready (MMPortProbe *probe, port_probe_run_ready (MMPortProbe *probe,
GAsyncResult *probe_result, GAsyncResult *probe_result,
@@ -402,9 +392,13 @@ port_probe_run_ready (MMPortProbe *probe,
if (priv->single_at && if (priv->single_at &&
ctx->flags & MM_PORT_PROBE_AT && ctx->flags & MM_PORT_PROBE_AT &&
mm_port_probe_is_at (probe)) { mm_port_probe_is_at (probe)) {
g_hash_table_foreach (priv->tasks, GList *l;
(GHFunc) cancel_at_probing_in_other_probes,
probe); for (l = mm_device_peek_port_probe_list (ctx->device); l; l = g_list_next (l)) {
if (l->data != probe) {
mm_port_probe_run_cancel_at_probing (MM_PORT_PROBE (l->data));
}
}
} }
} else { } else {
@@ -430,6 +424,7 @@ port_probe_run_ready (MMPortProbe *probe,
g_free (key); g_free (key);
} }
g_object_unref (ctx->device);
g_object_unref (ctx->result); g_object_unref (ctx->result);
g_object_unref (ctx->plugin); g_object_unref (ctx->plugin);
g_free (ctx); g_free (ctx);
@@ -557,6 +552,7 @@ mm_plugin_supports_port (MMPlugin *self,
/* Setup async call context */ /* Setup async call context */
ctx = g_new (PortProbeRunContext, 1); ctx = g_new (PortProbeRunContext, 1);
ctx->plugin = g_object_ref (self); ctx->plugin = g_object_ref (self);
ctx->device = g_object_ref (device);
ctx->result = g_object_ref (async_result); ctx->result = g_object_ref (async_result);
ctx->flags = probe_run_flags; ctx->flags = probe_run_flags;