← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~mterry/indicator-datetime/cancel-crash into lp:indicator-datetime

 

Michael Terry has proposed merging lp:~mterry/indicator-datetime/cancel-crash into lp:indicator-datetime.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  Bug #734951 in indicator-datetime (Ubuntu): "indicator-datetime-preferences crashed with SIGSEGV in g_simple_async_result_complete()"
  https://bugs.launchpad.net/ubuntu/+source/indicator-datetime/+bug/734951

For more details, see:
https://code.launchpad.net/~mterry/indicator-datetime/cancel-crash/+merge/54782

Make sure not to touch priv if we're being cancelled, because this might be post-dispose (GIO async operations cancel in the idle loop).
-- 
https://code.launchpad.net/~mterry/indicator-datetime/cancel-crash/+merge/54782
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'src/timezone-completion.c'
--- src/timezone-completion.c	2011-03-23 15:58:50 +0000
+++ src/timezone-completion.c	2011-03-24 20:56:28 +0000
@@ -99,14 +99,15 @@
 
   json_parser_load_from_stream_finish (JSON_PARSER (object), res, &error);
 
-  if (priv->cancel && (error == NULL || error->code != G_IO_ERROR_CANCELLED)) {
+  if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel) {
     g_cancellable_reset (priv->cancel);
   }
 
   if (error != NULL) {
+    if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+      save_and_use_model (completion, priv->initial_model);
     g_warning ("Could not parse geoname JSON data: %s", error->message);
     g_error_free (error);
-    save_and_use_model (completion, priv->initial_model);
     return;
   }
 
@@ -203,14 +204,15 @@
 
   stream = g_file_read_finish (G_FILE (object), res, &error);
 
-  if (priv->cancel && (error == NULL || error->code != G_IO_ERROR_CANCELLED)) {
+  if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel) {
     g_cancellable_reset (priv->cancel);
   }
 
   if (error != NULL) {
+    if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+      save_and_use_model (completion, priv->initial_model);
     g_warning ("Could not connect to geoname lookup server: %s", error->message);
     g_error_free (error);
-    save_and_use_model (completion, priv->initial_model);
     return;
   }
 


Follow ups