Skip to content

Commit 06c856a

Browse files
committed
fix memory leak
1 parent 3d7e1e1 commit 06c856a

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/tree_node.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,13 @@ NodeStatus TreeNode::executeTick()
106106
if(!substituted)
107107
{
108108
using namespace std::chrono;
109-
110-
auto t1 = steady_clock::now();
111-
// trick to prevent the compile from reordering the order of execution. See #861
112-
// This makes sure that the code is executed at the end of this scope
113-
std::shared_ptr<void> execute_later(nullptr, [&](...) {
114-
auto t2 = steady_clock::now();
115-
if(monitor_tick)
116-
{
117-
monitor_tick(*this, new_status, duration_cast<microseconds>(t2 - t1));
118-
}
119-
});
120-
109+
const auto t1 = steady_clock::now();
121110
new_status = tick();
111+
const auto t2 = steady_clock::now();
112+
if(monitor_tick)
113+
{
114+
monitor_tick(*this, new_status, duration_cast<microseconds>(t2 - t1));
115+
}
122116
}
123117
}
124118

0 commit comments

Comments
 (0)