- Fixed #555 that caused a segfault when 'log' was used with a project,
  because the onProjectChange code assumes the files are still open, and
  they were not.  Checked all other commands for similar problem.
- Added Itay Perl to the AUTHORS file.
- Added unit test.
This commit is contained in:
Paul Beckingham 2010-11-20 09:48:19 -05:00
parent d3303f6a98
commit 94480c23d2
4 changed files with 64 additions and 1 deletions

View file

@ -64,3 +64,5 @@ suggestions:
Michelle Crane Michelle Crane
Elizabeth Maxson Elizabeth Maxson
Peter De Poorter Peter De Poorter
Itay Perl

View file

@ -10,6 +10,8 @@
+ Fixed bug #538, where some color legend items were not readable. + 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 + Fixed bug #539, where the man page task-color(5) contained a line that
began with a ' and was not displayed. 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 ------------------------------ ------ old releases ------------------------------

View file

@ -195,12 +195,12 @@ int handleLog (std::string& outs)
context.tdb.lock (context.config.getBoolean ("locking")); context.tdb.lock (context.config.getBoolean ("locking"));
context.tdb.add (context.task); context.tdb.add (context.task);
context.tdb.commit (); context.tdb.commit ();
context.tdb.unlock ();
if (context.config.getBoolean ("echo.command")) if (context.config.getBoolean ("echo.command"))
out << "Logged task.\n"; out << "Logged task.\n";
context.footnote (onProjectChange (context.task)); context.footnote (onProjectChange (context.task));
context.tdb.unlock ();
outs = out.str (); outs = out.str ();
context.hooks.trigger ("post-log-command"); context.hooks.trigger ("post-log-command");

59
src/tests/bug.555.t Executable file
View file

@ -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;