* fix threading in the presence of duplicate messages

This commit is contained in:
Dirk-Jan C. Binnema
2011-10-10 08:36:34 +03:00
parent 7e5df3c090
commit 41a8ae3124
2 changed files with 8 additions and 19 deletions

View File

@ -90,8 +90,7 @@ find_last (MuContainer *c)
} }
#if 0 G_GNUC_UNUSED static gboolean
static gboolean
check_dup (MuContainer *c, GHashTable *hash) check_dup (MuContainer *c, GHashTable *hash)
{ {
if (g_hash_table_lookup (hash, c)) { if (g_hash_table_lookup (hash, c)) {
@ -118,7 +117,6 @@ assert_no_duplicates (MuContainer *c)
g_hash_table_destroy (hash); g_hash_table_destroy (hash);
} }
#endif
MuContainer* MuContainer*
@ -598,5 +596,3 @@ mu_container_thread_info_hash_new (MuContainer *root_set, size_t matchnum)
return ti.hash; return ti.hash;
} }

View File

@ -100,10 +100,7 @@ mu_threader_calculate (MuMsgIter *iter, size_t matchnum,
return thread_ids; return thread_ids;
} }
G_GNUC_UNUSED static void
#if 0
static void
check_dup (const char *msgid, MuContainer *c, GHashTable *hash) check_dup (const char *msgid, MuContainer *c, GHashTable *hash)
{ {
if (g_hash_table_lookup (hash, c)) { if (g_hash_table_lookup (hash, c)) {
@ -114,21 +111,19 @@ check_dup (const char *msgid, MuContainer *c, GHashTable *hash)
g_hash_table_insert (hash, c, GUINT_TO_POINTER(TRUE)); g_hash_table_insert (hash, c, GUINT_TO_POINTER(TRUE));
} }
static void
G_GNUC_UNUSED static void
assert_no_duplicates (GHashTable *ids) assert_no_duplicates (GHashTable *ids)
{ {
GHashTable *hash; GHashTable *hash;
hash = g_hash_table_new (g_direct_hash, g_direct_equal); hash = g_hash_table_new (g_direct_hash, g_direct_equal);
g_hash_table_foreach (ids, g_hash_table_foreach (ids, (GHFunc)check_dup, hash);
(GHFunc)check_dup,
hash);
g_hash_table_destroy (hash); g_hash_table_destroy (hash);
} }
#endif
@ -189,10 +184,7 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid)
c2 = mu_container_new (msg, docid, "<dup>"); c2 = mu_container_new (msg, docid, "<dup>");
c2->flags = MU_CONTAINER_FLAG_DUP; c2->flags = MU_CONTAINER_FLAG_DUP;
c = mu_container_append_children (c, c2); c = mu_container_append_children (c, c2);
g_hash_table_insert (id_table, /* don't add it to the id_table */
(gpointer)mu_msg_get_path (msg), c2);
/* assert_no_duplicates (id_table); */
return NULL; /* don't process this message further */ return NULL; /* don't process this message further */
} }
} else { /* Else: Create a new MuContainer object holding } else { /* Else: Create a new MuContainer object holding
@ -367,6 +359,8 @@ prune_maybe (MuContainer *c)
c = mu_container_splice_children (c, cur); c = mu_container_splice_children (c, cur);
} }
g_return_val_if_fail (c, FALSE);
/* don't touch containers with messages */ /* don't touch containers with messages */
if (c->msg) if (c->msg)
return TRUE; return TRUE;
@ -419,4 +413,3 @@ prune_empty_containers (MuContainer *root_set)
return root_set; return root_set;
} }