diff options
author | Pekka Pessi <Pekka.Pessi@nokia.com> | 2010-07-12 17:48:46 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-12 12:03:00 -0300 |
commit | 20ad3ceb66efd6c3e9d6225a2b0c0c1fc2da41c8 (patch) | |
tree | 469950f1ded18fdb71d0dd0e6e97e2f2a3102417 /src/task.c | |
parent | f40f0a4eed273c7beeb506126abde1989335eded (diff) | |
download | connman-20ad3ceb66efd6c3e9d6225a2b0c0c1fc2da41c8.tar.gz connman-20ad3ceb66efd6c3e9d6225a2b0c0c1fc2da41c8.tar.bz2 connman-20ad3ceb66efd6c3e9d6225a2b0c0c1fc2da41c8.zip |
Remove child watch when connman_task is freed
Diffstat (limited to 'src/task.c')
-rw-r--r-- | src/task.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -39,6 +39,7 @@ struct notify_data { struct connman_task { char *path; pid_t pid; + guint child_watch; GPtrArray *argv; GPtrArray *envp; connman_task_exit_t exit_func; @@ -69,6 +70,9 @@ static void free_task(gpointer data) if (task->pid > 0) kill(task->pid, SIGTERM); + if (task->child_watch > 0) + g_source_remove(task->child_watch); + g_ptr_array_foreach(task->envp, free_pointer, NULL); g_ptr_array_free(task->envp, TRUE); @@ -251,6 +255,8 @@ static void task_died(GPid pid, gint status, gpointer user_data) g_spawn_close_pid(pid); task->pid = -1; + task->child_watch = 0; + if (task->exit_func) task->exit_func(task, task->exit_data); } @@ -328,7 +334,7 @@ int connman_task_run(struct connman_task *task, return -EIO; } - g_child_watch_add(task->pid, task_died, task); + task->child_watch = g_child_watch_add(task->pid, task_died, task); return 0; } |