[anjal] BUGFIX: GNOME Bugzilla #591650 - emts_insert_info_incr() dead loop due to empty entries in hash tabl
- From: Yan Li <yanli src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjal] BUGFIX: GNOME Bugzilla #591650 - emts_insert_info_incr() dead loop due to empty entries in hash tabl
- Date: Fri, 14 Aug 2009 07:05:06 +0000 (UTC)
commit 4d5c5665d3f786f465620416000d2783856398a8
Author: Yan Li <yan i li intel com>
Date: Fri Aug 14 15:01:31 2009 +0800
BUGFIX: GNOME Bugzilla #591650 - emts_insert_info_incr() dead loop due to empty entries in hash table
emts_insert_info_incr() inserts new messages into emts, and tries to
find a parent for the new message. But if an empty parent message node
(node->info==NULL) is found, it may dead loop on
em-tree-store.c:784. Now we run prune_empty nodes when an empty parent
is found.
Signed-off-by: Yan Li <yan i li intel com>
src/em-tree-store.c | 15 ++++++++++++---
src/em-tree-store.h | 1 +
2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/em-tree-store.c b/src/em-tree-store.c
index b526f99..cffa364 100644
--- a/src/em-tree-store.c
+++ b/src/em-tree-store.c
@@ -44,6 +44,7 @@
#define node_has_children(node) ((node->flags & EM_TREE_NODE_LEAF) == 0 && node->children.head != (EDListNode *)&node->children.tail)
static time_t emts_thread_time (EMTreeStore *emts, EMTreeNode *node, char **);
static gboolean emts_thread_unread (EMTreeStore *emts, EMTreeNode *node);
+static void emts_prune_empty(EMTreeStore *emts, EMTreeNode *node);
struct _emts_folder {
struct _emts_folder *next;
@@ -776,17 +777,25 @@ emts_insert_info_incr(EMTreeStore *emts, CamelMessageInfo *mi, struct _emts_fold
&& (parent = g_hash_table_lookup(p->id_table, &references->references[j]))
&& parent != node) {
EMTreeNode *tmpnode;
+
+ if (NULL == parent->info)
+ {
+ printf(" found an empty parent, pruning\n");
+ emts_prune_empty (emts, parent);
+ continue;
+ }
+
printf(" found parent, reparenting\n");
node->parent = parent;
//e_dlist_remove((EDListNode *)node);
e_dlist_addtail(&parent->children, (EDListNode *)node);
tmpnode = parent;
while (tmpnode != NULL && tmpnode != emts->root)
- tmpnode = tmpnode->parent;
- if (tmpnode != NULL) {
+ {
tmpnode->latest_uid = mi->uid;
- ret = TRUE;
+ tmpnode = tmpnode->parent;
}
+ ret = TRUE;
break;
}
}
diff --git a/src/em-tree-store.h b/src/em-tree-store.h
index 9fe2555..c37109c 100644
--- a/src/em-tree-store.h
+++ b/src/em-tree-store.h
@@ -52,6 +52,7 @@ struct _EMTreeNode {
CamelMessageInfo *info;
unsigned int flags:4;
+ /* uid of the latest message in the thread of this node */
const char *latest_uid;
gpointer msg_ref;
EDList children;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]