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.
This commit is contained in:
Robbert van der Helm
2021-05-16 00:30:46 +02:00
parent 70a546d160
commit fc04e2edcb
+2 -5
View File
@@ -212,11 +212,8 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
// 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<Request> persistent_object =
persistent_buffers ? std::make_optional<Request>() : std::nullopt;
thread_local std::optional<Request> persistent_object(
persistent_buffers ? std::make_optional<Request>() : 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