]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-program-client: Stop waiting ioloop on destruction
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 7 Feb 2022 08:14:53 +0000 (09:14 +0100)
committerKarl Fleischmann <karl.fleischmann@open-xchange.com>
Mon, 7 Feb 2022 08:14:53 +0000 (09:14 +0100)
src/lib-program-client/program-client-private.h
src/lib-program-client/program-client.c

index 5f6260a5469b16d9777ec6fb22e1ba0dd88340fa..697cef1541e7920e375b6f0aa926e4ffa2e2cc6c 100644 (file)
@@ -35,6 +35,7 @@ struct program_client {
        struct io *io;
        struct timeout *to;
        struct timeval start_time;
+       struct ioloop *wait_ioloop;
 
        struct istream *input, *program_input, *raw_program_input;
        struct ostream *output, *program_output, *raw_program_output;
index 62e4fd7dd88aa3664d4b8619fd15a0f365d776a2..ad7dfa72ff1a4c94f8630c2f6401cd816920181e 100644 (file)
@@ -37,6 +37,8 @@ program_client_callback(struct program_client *pclient, int result,
        pclient->callback = NULL;
        if (pclient->destroying || callback == NULL)
                return;
+       if (pclient->wait_ioloop != NULL)
+               io_loop_stop(pclient->wait_ioloop);
        callback(result, context);
 }
 
@@ -754,7 +756,9 @@ void program_client_wait(struct program_client *pclient)
 
        program_client_switch_ioloop(pclient);
 
+       pclient->wait_ioloop = ioloop;
        io_loop_run(ioloop);
+       pclient->wait_ioloop = NULL;
 
        io_loop_set_current(prev_ioloop);
        program_client_switch_ioloop(pclient);