Hey Arthur,

Thanks to you and your Debian cohorts for the patch. I'll apply it and
release 0.1.19 soonish.

Regards,
Alec

On Sat, May 07, 2005 at 02:12:14PM +0200, Arthur Korn wrote:
> Hi Alec!
>
> I managed to ask the right people for help ... :)
>
> Date: Fri, 6 May 2005 18:59:34 -0600
> To: [EMAIL PROTECTED]
> From: "Wesley J. Landaker" <[EMAIL PROTECTED]>
> Subject: Bug#307226: here is a patch
>
> package devtodo
> tag 30722 patch
> thanks
>
> Okay, this is an easy fix, and is obvious once you see it, but it was tricky
> to track down. Basically, it's a classic case of an object being referenced
> AFTER it is deleted. Of course it works sometimes, on some architectures,
> but doesn't work in general.
>
> --- TodoDB.cc.orig      2005-05-06 18:54:53.311120870 -0600
> +++ TodoDB.cc   2005-05-06 18:53:18.838482894 -0600
> @@ -749,8 +749,8 @@
>                         erased++;
>                         if (options.verbose > 1)
>                                 cout << info << "todo: permanently removing
> item '" << (*j) << "'" << normal << endl;
> -                       erase(todo, *j);
>                         t->db->setDirty(true);
> +                       erase(todo, *j);
>                 } else
>                         notfound.push_back(*j);
>         }
>
>
> Watching t->db in the debugged, you can see the pointer change after
> erase(todo, *j) is called. My guess is this doesn't happen (out of luck,
> probably) on i386, but it does on amd64.
>
> Anyway, the fix is just to set the db dirty flag BEFORE deleting the todo
> that holds the pointer to it. Piece of cake. =)
>
> (We should probably send this patch upstream as it is not an amd64 specific
> fix, and could break other architectures as well.)
>
> --
> Wesley J. Landaker <[EMAIL PROTECTED]>
> OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2
>
> --- TodoDB.cc.orig    2005-05-06 18:54:53.311120870 -0600
> +++ TodoDB.cc 2005-05-06 18:53:18.838482894 -0600
> @@ -749,8 +749,8 @@
>                       erased++;
>                       if (options.verbose > 1)
>                               cout << info << "todo: permanently removing 
> item '" << (*j) << "'" << normal << endl;
> -                     erase(todo, *j);
>                       t->db->setDirty(true);
> +                     erase(todo, *j);
>               } else
>                       notfound.push_back(*j);
>       }
>
>
> ciao, 2ri
> --
> Secure email, spread GPG, clearsign all mail. http://www.gnupg.org
> .
> The universe is far too simple to be explained by mathematics.
>  -- zzendpad on slashdot.org about the Universal Theory(TM)



--
Evolution: Taking care of those too stupid to take care of themselves.

Attachment: pgpdURAIzgr8l.pgp
Description: PGP signature

Reply via email to