fix background jobs (GTK) newapi

Tue, 11 Jun 2024 21:49:26 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 11 Jun 2024 21:49:26 +0200
branch
newapi
changeset 290
0dcf13ba5a78
parent 289
6048b20bd46f
child 291
302a150ff5e4

fix background jobs (GTK)

application/main.c file | annotate | diff | comparison | revisions
ui/gtk/toolkit.c file | annotate | diff | comparison | revisions
--- a/application/main.c	Tue Jun 11 21:49:13 2024 +0200
+++ b/application/main.c	Tue Jun 11 21:49:26 2024 +0200
@@ -102,7 +102,7 @@
 }
 
 void application_startup(UiEvent *event, void *data) {
-    
+      
     UiObject *obj = ui_window("Test", NULL);
     
     MyDocument *doc = create_doc();
--- a/ui/gtk/toolkit.c	Tue Jun 11 21:49:13 2024 +0200
+++ b/ui/gtk/toolkit.c	Tue Jun 11 21:49:26 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