diff options
author | Ted Gould <ted@gould.cx> | 2011-03-29 11:01:21 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-29 11:01:21 -0500 |
commit | 72b47b902755c77611774e082e1f3f7d66f171f1 (patch) | |
tree | 750f401ea52f9056688851d928f661acda73d762 /src | |
parent | 1efaecaa2d0bbbd371ba31a4593a3c8c5a64fa0a (diff) | |
parent | 47f806242850d509e1919780fa3eb2ec3598b356 (diff) | |
download | ayatana-indicator-datetime-72b47b902755c77611774e082e1f3f7d66f171f1.tar.gz ayatana-indicator-datetime-72b47b902755c77611774e082e1f3f7d66f171f1.tar.bz2 ayatana-indicator-datetime-72b47b902755c77611774e082e1f3f7d66f171f1.zip |
Protect our privates when being cancelled
Diffstat (limited to 'src')
-rw-r--r-- | src/timezone-completion.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/timezone-completion.c b/src/timezone-completion.c index a2fa643..a73ebf9 100644 --- a/src/timezone-completion.c +++ b/src/timezone-completion.c @@ -132,14 +132,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; } @@ -243,14 +244,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; } |