TDB2
- Disabled hook processing while processing hooks. This is because both ::add and ::modify can each add or modify tasks, and there is the potential for infinite recursion.
This commit is contained in:
@@ -137,7 +137,10 @@ bool TF2::get (const std::string& uuid, Task& task)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void TF2::add_task (Task& task)
|
void TF2::add_task (Task& task)
|
||||||
{
|
{
|
||||||
|
bool enabled = context.hooks.enable (false);
|
||||||
context.hooks.onAdd (task);
|
context.hooks.onAdd (task);
|
||||||
|
context.hooks.enable (enabled);
|
||||||
|
|
||||||
_tasks.push_back (task); // For subsequent queries
|
_tasks.push_back (task); // For subsequent queries
|
||||||
_added_tasks.push_back (task); // For commit/synch
|
_added_tasks.push_back (task); // For commit/synch
|
||||||
|
|
||||||
@@ -167,7 +170,10 @@ bool TF2::modify_task (const Task& task)
|
|||||||
if (i->get ("uuid") == uuid)
|
if (i->get ("uuid") == uuid)
|
||||||
{
|
{
|
||||||
Task hookTask (task);
|
Task hookTask (task);
|
||||||
|
|
||||||
|
bool enabled = context.hooks.enable (false);
|
||||||
context.hooks.onModify (*i, hookTask);
|
context.hooks.onModify (*i, hookTask);
|
||||||
|
context.hooks.enable (enabled);
|
||||||
|
|
||||||
*i = hookTask;
|
*i = hookTask;
|
||||||
_modified_tasks.push_back (hookTask);
|
_modified_tasks.push_back (hookTask);
|
||||||
|
|||||||
Reference in New Issue
Block a user