diff options
author | Mole Shang <[email protected]> | 2023-08-08 11:08:37 +0800 |
---|---|---|
committer | Mole Shang <[email protected]> | 2023-08-08 11:08:37 +0800 |
commit | f0121e1596dc5490b58b6dad1bfb8f3b83d19b94 (patch) | |
tree | 97d23f03a6e607d2414bbc5390b926031fbe6537 /src/process_url.c | |
parent | ea686558ff9d0e4a9c4ca07c1a3e79d49e5847e4 (diff) | |
download | hinata-f0121e1596dc5490b58b6dad1bfb8f3b83d19b94.tar.gz hinata-f0121e1596dc5490b58b6dad1bfb8f3b83d19b94.tar.bz2 hinata-f0121e1596dc5490b58b6dad1bfb8f3b83d19b94.zip |
process_url: do not block ui thread on callback
Diffstat (limited to 'src/process_url.c')
-rw-r--r-- | src/process_url.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/process_url.c b/src/process_url.c index e51da98..1bb411a 100644 --- a/src/process_url.c +++ b/src/process_url.c @@ -506,11 +506,13 @@ void poll_status(status_t *stat) { } merge_and_cleanup(curl_conf); append_log("Download %s finished.\n", curl_conf->outfn); + free_and_nullify(curl_conf); // Perform the callback if (is_empty_queue(&dl_queue) && callback_g) { - callback_g(p_callback_struct_g); + thrd_t cb_thrd; + thrd_create(&cb_thrd, callback_g, p_callback_struct_g); + thrd_detach(cb_thrd); } - free_and_nullify(curl_conf); } mtx_unlock(&mtx); } |