aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-03-24 16:54:00 -0400
committerMichael Terry <mike@mterry.name>2011-03-24 16:54:00 -0400
commit47f806242850d509e1919780fa3eb2ec3598b356 (patch)
tree24eadcc6bd17b4c4ddb76b8e0425f825174ebc5d
parent5449dfc11d34b4b5137605280e73a3fab13f7fb1 (diff)
downloadayatana-indicator-datetime-47f806242850d509e1919780fa3eb2ec3598b356.tar.gz
ayatana-indicator-datetime-47f806242850d509e1919780fa3eb2ec3598b356.tar.bz2
ayatana-indicator-datetime-47f806242850d509e1919780fa3eb2ec3598b356.zip
don't access priv pointer if we've cancelled an async operation
-rw-r--r--src/timezone-completion.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/timezone-completion.c b/src/timezone-completion.c
index aaf6bdc..dddc003 100644
--- a/src/timezone-completion.c
+++ b/src/timezone-completion.c
@@ -99,14 +99,15 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
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 @@ geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data)
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;
}