diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-11-21 03:12:51 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-11-21 03:24:45 +0800 |
commit | 0b98cf60cbe1350479e189ebcf54aeae775e6264 (patch) | |
tree | 81bd4cc57c476afce4eba75a11f55cd498a88525 /composer | |
parent | 836606a57224ec30b418c3905f0655698f8d407a (diff) | |
download | gsoc2013-evolution-0b98cf60cbe1350479e189ebcf54aeae775e6264.tar.gz gsoc2013-evolution-0b98cf60cbe1350479e189ebcf54aeae775e6264.tar.zst gsoc2013-evolution-0b98cf60cbe1350479e189ebcf54aeae775e6264.zip |
Fix some details in our asynchronous functions.
Don't unref the GAsyncResult in finish functions. Do it after calling
g_simple_async_result_complete(). This allows the GAsyncReadyCallback
to be optional, and we'll still clean up resources properly.
Also, don't call g_simple_async_result_complete_in_idle() unless we're
completing an operation from a separate thread, which we're not in any
of the current cases.
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-composer-autosave.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/composer/e-composer-autosave.c b/composer/e-composer-autosave.c index a4d5343653..b0bc659143 100644 --- a/composer/e-composer-autosave.c +++ b/composer/e-composer-autosave.c @@ -278,6 +278,7 @@ static void autosave_data_free (AutosaveData *data) { g_object_unref (data->composer); + g_object_unref (data->simple); if (data->input_stream != NULL) g_object_unref (data->input_stream); @@ -294,10 +295,7 @@ autosave_snapshot_check_for_error (AutosaveData *data, if (error == NULL) return FALSE; - /* Steal the result. */ simple = data->simple; - data->simple = NULL; - g_simple_async_result_set_from_error (simple, error); g_simple_async_result_set_op_res_gboolean (simple, FALSE); g_simple_async_result_complete (simple); @@ -321,10 +319,7 @@ autosave_snapshot_splice_cb (GOutputStream *output_stream, if (autosave_snapshot_check_for_error (data, error)) return; - /* Steal the result. */ simple = data->simple; - data->simple = NULL; - g_simple_async_result_set_op_res_gboolean (simple, TRUE); g_simple_async_result_complete (simple); @@ -353,11 +348,8 @@ autosave_snapshot_cb (GFile *file, if (message == NULL) { GSimpleAsyncResult *simple; - /* Steal the result. */ - simple = data->simple; - data->simple = NULL; - /* FIXME Need to set a GError here. */ + simple = data->simple; g_simple_async_result_set_op_res_gboolean (simple, FALSE); g_simple_async_result_complete (simple); g_object_unref (output_stream); @@ -463,7 +455,6 @@ e_composer_autosave_snapshot_finish (EMsgComposer *composer, simple = G_SIMPLE_ASYNC_RESULT (result); success = g_simple_async_result_get_op_res_gboolean (simple); g_simple_async_result_propagate_error (simple, error); - g_object_unref (simple); return success; } |