fix gtk executing ui_job_finished even if no finish callback was set

Tue, 11 Jun 2024 21:47:43 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 11 Jun 2024 21:47:43 +0200
changeset 39
ef4e2f560fa5
parent 38
acd8c4a9d3fe
child 40
af5c2bfe0f21

fix gtk executing ui_job_finished even if no finish callback was set

ui/gtk/toolkit.c file | annotate | diff | comparison | revisions
--- a/ui/gtk/toolkit.c	Tue Jun 11 21:45:39 2024 +0200
+++ b/ui/gtk/toolkit.c	Tue Jun 11 21:47:43 2024 +0200
@@ -185,8 +185,10 @@
 static void* ui_jobthread(void *data) {
     UiJob *job = data;
     int result = job->job_func(job->job_data);
-    if(!result) {
+    if(!result && job->finish_callback) {
         g_idle_add(ui_job_finished, job);
+    } else {
+        free(job);
     }
     return NULL;
 }

mercurial