<div dir='auto'>Hello,<div dir="auto">I have a rather large number of expressions, which I must normalize. To increase performance I wanted to implement this on multiple threads. However, this always segfaults and I am having trouble to find out where my error is. Consider the following code:</div><div dir="auto"><br></div><div dir="auto">```c++</div><div dir="auto">// H is a 9x9 matrix</div><div dir="auto">void norm_matrix(GiNaC::matrix& H) {</div><div dir="auto">    thread_pool tp = thread_pool();</div><div dir="auto">    auto n = 9;</div><div dir="auto">    std::vector<std::future<GiNaC::ex>> futures(n*n);</div><div dir="auto">    for(int r = 0; r < n; ++r) {</div><div dir="auto">         for(int c = 0; c < n; ++c) {</div><div dir="auto">             futures[r*n+c] = tp.submit(</div><div dir="auto">                  [&h = H(r,c)] () -> GiNaC::ex {</div><div dir="auto">                  return h.normal();</div><div dir="auto">             });</div><div dir="auto">         }</div><div dir="auto">    }</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">    for(int r = 0; r < n; ++r) {</div><div dir="auto">        for(int c = 0; c < n; ++c) {</div><div dir="auto">            H(r,c) = futures[r*n+c].get();</div><div dir="auto">        }</div><div dir="auto">    }</div><div dir="auto">}</div><div dir="auto">```</div><div dir="auto">At the second iterations on the call of h.normal(), this crashes with a segfault, both with a reference as well as with a copy. Has GiNaC been used in a multithreaded environment previously and has this error occured?</div><div dir="auto"><br></div><div dir="auto">Kind regards</div><div dir="auto">Spooky Ghost</div></div>