[libsoup/cache] soup-cache: keep the session alive until we are done flushing it to disk
- From: Xan Lopez <xan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libsoup/cache] soup-cache: keep the session alive until we are done flushing it to disk
- Date: Tue, 4 Aug 2009 11:57:51 +0000 (UTC)
commit f87fab4bde7fce3eb964227a1c3a38de7634d09b
Author: Xan Lopez <xan gnome org>
Date: Tue Aug 4 14:41:20 2009 +0300
soup-cache: keep the session alive until we are done flushing it to disk
Add a reference to the session for each cache entry that is in the
process of being written to disk; this way the session won't go away
in the middle of the process.
libsoup/soup-cache.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index 595f942..833e2c4 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -383,6 +383,9 @@ close_ready_cb (GObject *source, GAsyncResult *result, SoupCacheWritingFixture *
entry->pos = 0;
cache->priv->n_pending--;
+
+ /* Unref the session */
+ g_object_unref (cache->priv->session);
}
static void
@@ -533,6 +536,10 @@ append_to_ready_cb (GObject *source, GAsyncResult *result, SoupCacheWritingFixtu
if (error) {
entry->error = error;
fixture->cache->priv->n_pending--;
+
+ /* Unref the session here, since we weren't able to
+ even open the stream for writing */
+ g_object_unref (fixture->cache->priv->session);
return;
}
@@ -586,6 +593,9 @@ msg_got_headers_cb (SoupMessage *msg, SoupCache *cache)
fixture->cache = cache;
fixture->entry = entry;
+ /* Ref the session to keep it alive until we are done writing */
+ g_object_ref (cache->priv->session);
+
/* We connect now to these signals and buffer the data
if it comes before the file is ready for writing */
g_signal_connect (msg, "got-chunk", G_CALLBACK (msg_got_chunk_cb), fixture);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]