From 8a248dd93062eadc78f375a6f16cfd2e96b668a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 1 Aug 2018 13:46:33 +0300 Subject: [PATCH] Copy callbacks by value in mxs_rworker_broadcast Copying by reference will not work as the references will refer to the values passed to the function, not the actual callbacks. --- server/core/routingworker.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/core/routingworker.cc b/server/core/routingworker.cc index 3aa33b56b..1ef106592 100644 --- a/server/core/routingworker.cc +++ b/server/core/routingworker.cc @@ -1018,10 +1018,12 @@ protected: size_t mxs_rworker_broadcast(void (*cb)(void* data), void* data) { - return RoutingWorker::broadcast(std::auto_ptr(new FunctionTask([&]() + std::auto_ptr task(new FunctionTask([cb, data]() { cb(data); - }))); + })); + + return RoutingWorker::broadcast(task); } uint64_t mxs_rworker_create_key()