[libgdata] core: Ensure all GDataUploadStream ops are finished before freeing the message
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] core: Ensure all GDataUploadStream ops are finished before freeing the message
- Date: Mon, 20 Dec 2010 13:46:58 +0000 (UTC)
commit 6273d1c7161c892c42e76320fc87988fd58c02f8
Author: Philip Withnall <philip tecnocode co uk>
Date: Thu Dec 16 15:02:02 2010 +0000
core: Ensure all GDataUploadStream ops are finished before freeing the message
It was previously possible for the SoupMessage being used in an ongoing
upload to be unreffed (by dispose()) and destroyed before the ongoing network
operation finished, causing a crash. We now ensure that all network operations
are finished at the start of dispose(), rather than at the start of
finalize().
gdata/gdata-upload-stream.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c
index 084b016..e5b021e 100644
--- a/gdata/gdata-upload-stream.c
+++ b/gdata/gdata-upload-stream.c
@@ -274,6 +274,10 @@ gdata_upload_stream_dispose (GObject *object)
if (g_output_stream_is_closed (G_OUTPUT_STREAM (object)) == FALSE)
g_output_stream_close (G_OUTPUT_STREAM (object), NULL, NULL);
+ /* Wait for any outstanding operations to finish */
+ if (priv->network_thread != NULL)
+ g_thread_join (priv->network_thread);
+
if (priv->service != NULL)
g_object_unref (priv->service);
priv->service = NULL;
@@ -295,8 +299,6 @@ gdata_upload_stream_finalize (GObject *object)
{
GDataUploadStreamPrivate *priv = GDATA_UPLOAD_STREAM (object)->priv;
- if (priv->network_thread != NULL)
- g_thread_join (priv->network_thread);
g_static_mutex_free (&(priv->response_mutex));
g_cond_free (priv->finished_cond);
g_cond_free (priv->write_cond);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]