Version: (using KDE 4.2.0) OS: Linux Installed from: Compiled From Sources I am subscribed to a mailing list where all messages contain no "References" or "In-Reply-To" header. Because of this threading by subject is the only possible threading method. However the "thread starter" message is never grouped with the replies (i.e. all replies starting with "Re:" are displayed correctly threaded but the first message is not part of this display). Deleting the index files of the relevant folder did not help. Also setting the reply prefixes explicitly in "Configure->Composer->Subject->Reply Subject Prefixes" did not fix the issue.
Created attachment 31842 [details] Fix for subject threading problem My original description regarding the subject threading was not entirely correct (since there was always an additional blank added to "thread starter" subject headers by the mailing list SW). However even after correcting this (via a "rewrite header" filter) subject threading was still mostly incomplete and changing constantly (e.g. afer a kmail restart or arrival of new messages). For me the attached patch fixes the problem completely.
SVN commit 937009 by stefanek: Fix date-based sorting of the subject threading cache. BUG: 185796 M +42 -20 model.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=937009
The real bug is that the cache really should be sorted by date. Please check if the fix introduced in revision 937009 works for you.
I use 4.2 branch where the fix is not available. However a quick check with model.cpp and model.h copied from trunk to my 4.2 checkout looks like everything works fine with your fix. However after a further look at the code I think that the (delta<120) check is wrong (it should be delta<0). It is quite possible that two replies (in the same thread) for a previous message of this thread are sent within 2 minutes (e.g. by different senders). I did a quick check with "<60*60" to increase my chances of observing this condition and threading for many threads was now again wrong (i.e. several threads are now again split in multiple threads, e.g. Subject Re: Subject Re: Subject Some other subject Re: Subject Re: Subject I would understand the 2 minute heuristic if the above sample would result in something like 1) Subject 2) Re: Subject 3) Re: Subject 4) Re: Subject 5) Re: Subject 6) Some other subject assuming 2) and 4) have dates within a 2 minute range although I think to second guess the real hierarchy is not worth the effort since it is most probably wrong. Andreas
> However after a further look at the code I think that > the (delta<120) check is wrong (it should be delta<0). > It is quite possible that two replies (in the same thread) > for a previous message of this thread are sent within > 2 minutes (e.g. by different senders). The delta considers only parent-child relationships, not child-child relationships. This means that when looking for the parent of message A we discard all the parent candidates that have been sent less than 120 seconds earlier than message A. This is a reasonable heuristic. Two replies to the same message sent within the same second will still be correctly threaded (unless the 120 second check fails for both).
Ok, it seems that in my test with the increased delta the original message which started the thread was discarded by several replies leading to broken threads. This probably doesn't happen in reality. Something more serious: While experimenting I had reproducible crashes when trying to delete messages with the new code. See attached backtrace.
Created attachment 31949 [details] backtrace of crash during deletion of message
Yep. Looks like the yesterday's fix was incomplete... This assert() has been fixed this morning.
SVN commit 938208 by tmcguire: Backport r937009 by stefanek from trunk to the 4.2 branch: Fix date-based sorting of the subject threading cache. CCBUG: 185796 M +42 -20 model.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=938208