[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pan-users] Re: [0.95] Reproducible segfault when sorting on article nam
From: |
Charles Kerr |
Subject: |
[Pan-users] Re: [0.95] Reproducible segfault when sorting on article name |
Date: |
Mon, 08 May 2006 16:07:17 -0500 |
User-agent: |
Mozilla Thunderbird 1.0.8-1.4.1 (X11/20060420) |
walt wrote:
Charles Kerr wrote:
walt wrote:
I see that 0.96 already has this patch, and it's behavior
is slightly different but no better, alas:
Ha! Well, let's try again. Here's a patch against 0.96.
Well, it's better. Now, for example, I can sort the gmane
pan.user group by Subject and it works just fine.
But, when I go back to alt.binaries.pictures.animals on
my ISP's server and try sorting on Subject I get the same
old segfault. I see hundreds of pairs of lines like below,
followed by the segfault:
(pan:12857): GLib-CRITICAL **: g_utf8_casefold: assertion `str != NULL'
failed
(pan:12857): GLib-CRITICAL **: g_utf8_collate_key: assertion `str !=
NULL' failed
Ahhh, I see! What's happening is this: When sorting by subject,
Pan strips out everything before the first letter, so that a Subject
like "!! Guess What !!" will be sorted as if it were "Guess What !!".
My ``is this subject empty'' check was premature: it should've
happened _after_ that leading junk is stripped. Otherwise a Subject
with no letters could pass my is-empty test, then get stripped down
to emptiness anyway.
So. Attached is another patch against 0.96.
cheers,
Charles
--- pan/gui/header-pane.cc.bak 2006-05-08 11:19:05.000000000 -0500
+++ pan/gui/header-pane.cc 2006-05-08 15:56:51.000000000 -0500
@@ -78,6 +78,10 @@
StringView in (view);
while (!in.empty() && !isalpha(*in.str))
in.eat_chars (1);
+
+ if (in.empty())
+ return g_strdup ("");
+
char * casefold = g_utf8_casefold (in.str, in.len);
char * ret = g_utf8_collate_key (casefold, -1);
g_free (casefold);
@@ -89,9 +93,8 @@
{
const char * pch = (const char*) pan_tree_store_peek_value
(PAN_TREE_STORE(model), iter, COL_COLLATED_AUTHOR);
if (!pch) {
- const Article * a (get_article (model, iter));
- const char * in = a->author.empty() ? "" : a->author.c_str();
- char * tmp = do_collate (in);
+ const Article * article (get_article (model, iter));
+ char * tmp = do_collate (article->author.to_view());
pan_tree_store_set (PAN_TREE_STORE(model), iter, COL_COLLATED_AUTHOR,
tmp, -1);
g_free (tmp);
pch = get_collated_author (model, iter);
@@ -104,9 +107,8 @@
{
const char * pch = (const char*) pan_tree_store_peek_value
(PAN_TREE_STORE(model), iter, COL_COLLATED_SUBJECT);
if (!pch) {
- const Article * a (get_article (model, iter));
- const char * in = a->subject.empty() ? "" : a->subject.c_str();
- char * tmp = do_collate (in);
+ const Article * article (get_article (model, iter));
+ char * tmp = do_collate (article->subject.to_view());
pan_tree_store_set (PAN_TREE_STORE(model), iter, COL_COLLATED_SUBJECT,
tmp, -1);
g_free (tmp);
pch = get_collated_subject (model, iter);