[evolution-data-server/gnome-3-8] [NNTP] Fails to get list of folders, if not connected already



commit 519213c7eb1f2ff2e4bddf93775a86ec28886ab6
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 30 14:22:01 2013 +0200

    [NNTP] Fails to get list of folders, if not connected already
    
    The code, incorrectly, assumed that the store is always connected
    when a list of folders is requested, but the actual connection
    happens only during command invocation, after whose successful
    finish it's ensured that there is defined also a stream.
    
    This can be reproduced by creating a new NNTP account and trying
    to manage subscription. The first try fails, console is filled with
    runtime warnings, the second try shows list of available folders.

 camel/providers/nntp/camel-nntp-store.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 66edeca..86ab74c 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -1161,7 +1161,7 @@ nntp_store_get_folder_info_all (CamelNNTPStore *nntp_store,
                                 GCancellable *cancellable,
                                 GError **error)
 {
-       CamelNNTPStream *nntp_stream;
+       CamelNNTPStream *nntp_stream = NULL;
        CamelNNTPStoreSummary *nntp_store_summary;
        CamelNNTPStoreInfo *si;
        guint len;
@@ -1169,7 +1169,6 @@ nntp_store_get_folder_info_all (CamelNNTPStore *nntp_store,
        gint ret = -1;
        CamelFolderInfo *fi = NULL;
 
-       nntp_stream = camel_nntp_store_ref_stream (nntp_store);
        nntp_store_summary = camel_nntp_store_ref_summary (nntp_store);
 
        if (top == NULL)
@@ -1197,6 +1196,8 @@ nntp_store_get_folder_info_all (CamelNNTPStore *nntp_store,
                                goto do_complete_list;
                        }
 
+                       nntp_stream = camel_nntp_store_ref_stream (nntp_store);
+
                        while ((ret = camel_nntp_stream_line (nntp_stream, &line, &len, cancellable, error)) 
0)
                                nntp_store_info_update (nntp_store, (gchar *) line);
                } else {
@@ -1223,6 +1224,8 @@ nntp_store_get_folder_info_all (CamelNNTPStore *nntp_store,
                        for (i = 0; (si = (CamelNNTPStoreInfo *) camel_store_summary_index 
(CAMEL_STORE_SUMMARY (nntp_store_summary), i)); i++)
                                g_hash_table_insert (all, si->info.path, si);
 
+                       nntp_stream = camel_nntp_store_ref_stream (nntp_store);
+
                        while ((ret = camel_nntp_stream_line (nntp_stream, &line, &len, cancellable, error)) 
0) {
                                si = nntp_store_info_update (nntp_store, (gchar *) line);
                                g_hash_table_remove (all, si->info.path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]