]> git.street.me.uk Git - andy/viking.git/commitdiff
Don't crash when jobs are cancelled via the background jobs dialog.
authorJonas Norling <norling@lysator.liu.se>
Tue, 26 May 2009 18:06:06 +0000 (20:06 +0200)
committerGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Fri, 19 Jun 2009 20:14:18 +0000 (22:14 +0200)
src/background.c

index a7c4a3c81d91d1a1df0d999980ff33e259850a3c..d1d0c9b5ff461fc5b02897a58908e38670c896db 100644 (file)
@@ -62,9 +62,11 @@ int a_background_thread_progress ( gpointer callbackdata, gdouble fraction )
 {
   gpointer *args = (gpointer *) callbackdata;
   int res = a_background_testcancel ( callbackdata );
-  gdk_threads_enter();
-  gtk_list_store_set( GTK_LIST_STORE(bgstore), (GtkTreeIter *) args[5], PROGRESS_COLUMN, fraction*100, -1 );
-  gdk_threads_leave();
+  if (args[5] != NULL) {
+    gdk_threads_enter();
+    gtk_list_store_set( GTK_LIST_STORE(bgstore), (GtkTreeIter *) args[5], PROGRESS_COLUMN, fraction*100, -1 );
+    gdk_threads_leave();
+  }
 
   args[6] = GINT_TO_POINTER(GPOINTER_TO_INT(args[6])-1);
   bgitemcount--;
@@ -166,6 +168,7 @@ static void cancel_job_with_iter ( GtkTreeIter *piter )
     args[0] = GINT_TO_POINTER(1); /* set killswitch */
 
     gtk_list_store_remove ( bgstore, piter );
+    args[5] = NULL;
 }
 
 static void bgwindow_response (GtkDialog *dialog, gint arg1 )