From fc04e2edcb9cfd7b4900e40918b8dba6af27d701 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 16 May 2021 00:30:46 +0200 Subject: [PATCH] Properly initialize the thread local objects Instead of doing assignment. Assignment will probably reinitialize every cycle, and it also didn't work on one person's computer. --- src/common/communication/vst3.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/common/communication/vst3.h b/src/common/communication/vst3.h index 61fda61d..f6a60ddc 100644 --- a/src/common/communication/vst3.h +++ b/src/common/communication/vst3.h @@ -212,11 +212,8 @@ class Vst3MessageHandler : public AdHocSocketHandler { // process data, since that's the only object where allocations can // happen. The other objects we're storing here are very small, so the // extra wasted memory shouldn't matter much. - // FIXME: This of course doesn't work. The variant will have been - // reconstructed when the next process cycle hits, so we don't - // gain anything from this. - thread_local std::optional persistent_object = - persistent_buffers ? std::make_optional() : std::nullopt; + thread_local std::optional persistent_object( + persistent_buffers ? std::make_optional() : std::nullopt); // Reading, processing, and writing back the response for the requests // we receive works in the same way regardless of which socket we're