TW-1678: segfault in ~ViewTask()

- Column::setStyle now validates column styles.
- Thanks to Daniel Shahaf.
This commit is contained in:
Paul Beckingham 2015-09-09 23:39:51 -04:00
parent cb011026aa
commit 93e6ef5fb9
4 changed files with 14 additions and 3 deletions

View file

@ -30,7 +30,7 @@
- TW-1430 Slashes in project names don't work (thanks to Richard Boß). - TW-1430 Slashes in project names don't work (thanks to Richard Boß).
- TW-1432 start/stop can be issued on completed tasks (thanks to Renato Alves). - TW-1432 start/stop can be issued on completed tasks (thanks to Renato Alves).
- TW-1440 "task import" from STDIN (thanks to Renato Alves). - TW-1440 "task import" from STDIN (thanks to Renato Alves).
- TW-1448 Add possibility to modify newest task (thansk to Jens Erat). - TW-1448 Add possibility to modify newest task (thanks to Jens Erat).
- TW-1452 The uuid:<uuid> filter does not work (thanks to Tomas Babej). - TW-1452 The uuid:<uuid> filter does not work (thanks to Tomas Babej).
- TW-1454 Redundant dependency should not stop modification (thanks to Tomas - TW-1454 Redundant dependency should not stop modification (thanks to Tomas
Babej). Babej).
@ -143,6 +143,7 @@
- TW-1671 task add: segfault with foo-bar:1 (thanks to Daniel Shahaf). - TW-1671 task add: segfault with foo-bar:1 (thanks to Daniel Shahaf).
- TW-1675 project.not:something doesn't exclude project:something.subprojects - TW-1675 project.not:something doesn't exclude project:something.subprojects
(thanks to Ander). (thanks to Ander).
- TW-1678 segfault in ~ViewTask() (thanks to Daniel Shahaf).
- TW-1684 make no-date > has-date for all date attributes (thanks to David - TW-1684 make no-date > has-date for all date attributes (thanks to David
Patrick). Patrick).
- TW-1687 task add due:som appears to be interpreted as 'someday' (thanks to - TW-1687 task add due:som appears to be interpreted as 'someday' (thanks to

View file

@ -52,7 +52,7 @@ ColumnDue::~ColumnDue ()
// Note that you can not determine which gets called first. // Note that you can not determine which gets called first.
void ColumnDue::setStyle (const std::string& value) void ColumnDue::setStyle (const std::string& value)
{ {
_style = value; Column::setStyle (value);
if (_style == "countdown" && _label == STRING_COLUMN_LABEL_DUE) if (_style == "countdown" && _label == STRING_COLUMN_LABEL_DUE)
_label = STRING_COLUMN_LABEL_COUNT; _label = STRING_COLUMN_LABEL_COUNT;

View file

@ -247,6 +247,16 @@ void Column::renderHeader (
} }
} }
////////////////////////////////////////////////////////////////////////////////
void Column::setStyle (const std::string& style)
{
if (style != "default" &&
std::find (_styles.begin (), _styles.end (), style) == _styles.end ())
throw format (STRING_COLUMN_BAD_FORMAT, _name, style);
_style = style;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Column::validate (std::string& input) bool Column::validate (std::string& input)
{ {

View file

@ -53,7 +53,7 @@ public:
std::vector <std::string> styles () const { return _styles; } std::vector <std::string> styles () const { return _styles; }
std::vector <std::string> examples () const { return _examples; } std::vector <std::string> examples () const { return _examples; }
virtual void setStyle (const std::string& value) { _style = value; } virtual void setStyle (const std::string&);
virtual void setLabel (const std::string& value) { _label = value; } virtual void setLabel (const std::string& value) { _label = value; }
virtual void setReport (const std::string& value) { _report = value; } virtual void setReport (const std::string& value) { _report = value; }