aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-03-01 23:47:57 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-16 14:53:20 +0100
commit52ff02323d07d4b27755f7ad49bef5ee53e27109 (patch)
tree53d1f5db5a6701b6fd62eaba1106740138d2f996 /src
parentf8f09692894dc30e6bfd019554783b7a18de61a2 (diff)
plugin-manager: avoid race when port deferred until suggested and suggestion already there
It may happen that we launch the supports task in the port AFTER having received the suggestion.
Diffstat (limited to 'src')
-rw-r--r--src/mm-plugin-manager.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c
index 16e1e786..175762e7 100644
--- a/src/mm-plugin-manager.c
+++ b/src/mm-plugin-manager.c
@@ -331,12 +331,24 @@ supports_port_ready_cb (MMPlugin *plugin,
break;
case MM_PLUGIN_SUPPORTS_PORT_DEFER_UNTIL_SUGGESTED:
- /* We are deferred until a suggested plugin is given. If last supports task
- * of a given device is finished without finding a best plugin, this task
- * will get finished reporting unsupported. */
- mm_dbg ("(%s) deferring support check until result suggested",
- info->name);
- info->defer_until_suggested = TRUE;
+ /* If we arrived here and we already have a plugin suggested, use it */
+ if (info->suggested_plugin) {
+ mm_dbg ("(%s): (%s) task completed, got suggested plugin",
+ mm_plugin_get_name (info->suggested_plugin),
+ info->name);
+ /* Schedule checking support, which will end the operation */
+ info->best_plugin = info->suggested_plugin;
+ info->current = NULL;
+ info->source_id = g_idle_add ((GSourceFunc)find_port_support_idle,
+ info);
+ } else {
+ /* We are deferred until a suggested plugin is given. If last supports task
+ * of a given device is finished without finding a best plugin, this task
+ * will get finished reporting unsupported. */
+ mm_dbg ("(%s) deferring support check until result suggested",
+ info->name);
+ info->defer_until_suggested = TRUE;
+ }
break;
}
}