diff --git a/AUTHORS b/AUTHORS index 52ed1fe9e..548dafa72 100644 --- a/AUTHORS +++ b/AUTHORS @@ -64,3 +64,5 @@ suggestions: Michelle Crane Elizabeth Maxson Peter De Poorter + Itay Perl + diff --git a/ChangeLog b/ChangeLog index 894d09898..08ec3adaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ + Fixed bug #538, where some color legend items were not readable. + Fixed bug #539, where the man page task-color(5) contained a line that began with a ' and was not displayed. + + Fixed bug #555, which caused a segfault when logging a task with a project + (thanks to Itay Perl). ------ old releases ------------------------------ diff --git a/src/command.cpp b/src/command.cpp index 8ffa6b7fa..ebfd9075b 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -195,12 +195,12 @@ int handleLog (std::string& outs) context.tdb.lock (context.config.getBoolean ("locking")); context.tdb.add (context.task); context.tdb.commit (); - context.tdb.unlock (); if (context.config.getBoolean ("echo.command")) out << "Logged task.\n"; context.footnote (onProjectChange (context.task)); + context.tdb.unlock (); outs = out.str (); context.hooks.trigger ("post-log-command"); diff --git a/src/tests/bug.555.t b/src/tests/bug.555.t new file mode 100755 index 000000000..23eda8598 --- /dev/null +++ b/src/tests/bug.555.t @@ -0,0 +1,59 @@ +#! /usr/bin/perl +################################################################################ +## taskwarrior - a command line task list manager. +## +## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez. +## All rights reserved. +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, write to the +## +## Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, +## Boston, MA +## 02110-1301 +## USA +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 6; + +# Create the rc file. +if (open my $fh, '>', 'bug.rc') +{ + print $fh "data.location=.\n"; + + close $fh; + ok (-r 'bug.rc', 'Created bug.rc'); +} + +# Bug #555 - log with a project segfaults. +my $output = qx{../task rc:bug.rc log description project:p}; +unlike ($output, qr/Segmentation fault/, 'no segfault from log with project'); + +# Cleanup. +unlink 'pending.data'; +ok (!-r 'pending.data', 'Removed pending.data'); + +unlink 'completed.data'; +ok (!-r 'completed.data', 'Removed completed.data'); + +unlink 'undo.data'; +ok (!-r 'undo.data', 'Removed undo.data'); + +unlink 'bug.rc'; +ok (!-r 'bug.rc', 'Removed bug.rc'); + +exit 0;