diff options
author | Thomas White <taw@physics.org> | 2020-05-14 10:55:51 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:57 +0200 |
commit | bf3ad7ed1aea595b5730a0c10c3b74e233012aee (patch) | |
tree | 1ebfdf82d4d83b215ab30bcdb490b2ed449961a4 /src/gui_backend_local.c | |
parent | 71e68294863600057f56865443036638b870f17a (diff) |
Shut down indexamajig process on exit
Diffstat (limited to 'src/gui_backend_local.c')
-rw-r--r-- | src/gui_backend_local.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gui_backend_local.c b/src/gui_backend_local.c index 2eb5d2b8..ca1ffc73 100644 --- a/src/gui_backend_local.c +++ b/src/gui_backend_local.c @@ -39,6 +39,8 @@ struct local_backend_priv int indexamajig_running; guint indexamajig_watch; GPid indexamajig_pid; + guint child_watch_source; + guint index_readable_source; }; @@ -221,12 +223,13 @@ static int run_unitcell(struct crystfelproject *proj, } priv->indexamajig_running = 1; - g_child_watch_add(priv->indexamajig_pid, - watch_indexamajig, proj); + priv->child_watch_source = g_child_watch_add(priv->indexamajig_pid, + watch_indexamajig, proj); ioch = g_io_channel_unix_new(ch_stderr); - g_io_add_watch(ioch, G_IO_IN | G_IO_ERR | G_IO_HUP, - index_readable, proj); + priv->index_readable_source = g_io_add_watch(ioch, + G_IO_IN | G_IO_ERR | G_IO_HUP, + index_readable, proj); return 0; } @@ -247,7 +250,11 @@ static void shutdown_backend(struct crystfelproject *proj) { struct local_backend_priv *priv = proj->backend_private; - /* FIXME: Shutdown indexamajig child process */ + if ( priv->indexamajig_running ) { + g_source_remove(priv->child_watch_source); + g_source_remove(priv->index_readable_source); + kill(-priv->indexamajig_pid, SIGINT); + } free(priv); } |