summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/delayed.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/glibext/delayed.c b/src/glibext/delayed.c
index 9bac68a..e93edc2 100644
--- a/src/glibext/delayed.c
+++ b/src/glibext/delayed.c
@@ -498,7 +498,7 @@ static void g_work_group_finalize(GWorkGroup *group)
/******************************************************************************
* *
-* Paramètres : type = type dont seront marqués tous les travaux donnés. *
+* Paramètres : id = identifiant accordé au nouveau groupe. *
* *
* Description : Crée un nouveau thread dédié à un type de travaux donné. *
* *
@@ -1021,6 +1021,7 @@ wgroup_id_t g_work_queue_define_work_group(GWorkQueue *queue)
void g_work_queue_delete_work_group(GWorkQueue *queue, wgroup_id_t id)
{
size_t i; /* Boucle de parcours */
+ GWorkGroup *group; /* Groupe de travail manipulé */
#ifndef NDEBUG
bool found; /* Repérage du groupe visé */
#endif
@@ -1032,8 +1033,13 @@ void g_work_queue_delete_work_group(GWorkQueue *queue, wgroup_id_t id)
g_mutex_lock(&queue->mutex);
for (i = 0; i < queue->groups_count; i++)
- if (g_work_group_get_id(queue->groups[i]) == id)
+ {
+ group = queue->groups[i];
+
+ if (g_work_group_get_id(group) == id)
{
+ g_object_unref(G_OBJECT(group));
+
memmove(&queue->groups[i], &queue->groups[i + 1],
(queue->groups_count - i - 1) * sizeof(GWorkGroup *));
@@ -1049,6 +1055,8 @@ void g_work_queue_delete_work_group(GWorkQueue *queue, wgroup_id_t id)
}
+ }
+
assert(found);
g_cond_broadcast(&queue->wait_all);