mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TW-1723: task info causes segfault
- Thanks to Roman Golovin. - Calls like 'context.columns[name]' autovivify the key 'name' with a default ctor value, which ends up polluting the context.columns map with every unique attribute name, which is a lot of 'annotation_nnnnnnnnnn' attributes.
This commit is contained in:
parent
fdda485032
commit
79189c448c
4 changed files with 37 additions and 31 deletions
|
@ -17,6 +17,7 @@
|
|||
- TW-1704 Use Task::identifier to reference the Task in the output
|
||||
- TW-1720 CmdContext uses a mix of both throw and std::cout to convey
|
||||
errors (thanks to Paul Beckingham).
|
||||
- TW-1723 task info causes segfault (thanks to Roman Golovin).
|
||||
- Fixed broken build for Cygwin and older GCC (thanks to Richard Boß).
|
||||
- The default configuration is now 256-color only.
|
||||
- The 'columns' report now shows whether a column is modifiable or read only.
|
||||
|
|
|
@ -501,7 +501,6 @@ bool Task::is_dueyear () const
|
|||
bool Task::is_udaPresent () const
|
||||
{
|
||||
for (auto& col : context.columns)
|
||||
if (col.first.compare (0, 11, "annotation_", 11) != 0)
|
||||
if (col.second->is_uda () &&
|
||||
has (col.first))
|
||||
return true;
|
||||
|
|
|
@ -361,9 +361,11 @@ int CmdInfo::execute (std::string& output)
|
|||
std::vector <std::string> all = task.all ();
|
||||
std::string type;
|
||||
for (auto& att: all)
|
||||
{
|
||||
if (context.columns.find (att) != context.columns.end ())
|
||||
{
|
||||
Column* col = context.columns[att];
|
||||
if (col && col->is_uda ())
|
||||
if (col->is_uda ())
|
||||
{
|
||||
std::string value = task.get (att);
|
||||
if (value != "")
|
||||
|
@ -387,13 +389,14 @@ int CmdInfo::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show any orphaned UDAs, which are identified by not being represented in
|
||||
// the context.columns map.
|
||||
for (auto& att : all)
|
||||
{
|
||||
if (att.substr (0, 11) != "annotation_" &&
|
||||
! context.columns[att])
|
||||
context.columns.find (att) == context.columns.end ())
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, "[" + att);
|
||||
|
|
|
@ -261,6 +261,8 @@ std::string taskInfoDifferences (
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string renderAttribute (const std::string& name, const std::string& value, const std::string& format /* = "" */)
|
||||
{
|
||||
if (context.columns.find (name) != context.columns.end ())
|
||||
{
|
||||
Column* col = context.columns[name];
|
||||
if (col &&
|
||||
|
@ -273,6 +275,7 @@ std::string renderAttribute (const std::string& name, const std::string& value,
|
|||
|
||||
return d.toString (format);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue