Index: gio/ChangeLog
===================================================================
--- gio/ChangeLog	(revision 7738)
+++ gio/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2008-12-09  Milan Crha  <mcrha@redhat.com>
+
+	Bug 562452 - improperly handled cancellation
+
+	* gsimpleasyncresult.c: (run_in_thread):
+	Check if cancelled after the main work done too.
+
 2008-12-09  Alexander Larsson  <alexl@redhat.com>
 
 	Bug 515777 - incorrect date&time on copy
Index: gio/gsimpleasyncresult.c
===================================================================
--- gio/gsimpleasyncresult.c	(revision 7738)
+++ gio/gsimpleasyncresult.c	(working copy)
@@ -604,16 +604,20 @@ run_in_thread (GIOSchedulerJob *job,
   RunInThreadData *data = _data;
   GSimpleAsyncResult *simple = data->simple;
 
+  if ((simple->handle_cancellation &&
+      !g_cancellable_is_cancelled (c)) ||
+      !simple->handle_cancellation)
+    data->func (simple,
+                simple->source_object,
+                c);
+
+  /* for a case where was the operation cancelled during the 'func' call */
   if (simple->handle_cancellation &&
       g_cancellable_is_cancelled (c))
     g_simple_async_result_set_error (simple,
                                      G_IO_ERROR,
                                      G_IO_ERROR_CANCELLED,
                                      "%s", _("Operation was cancelled"));
-  else
-    data->func (simple,
-                simple->source_object,
-                c);
 
   g_simple_async_result_complete_in_idle (data->simple);
   g_object_unref (data->simple);
