From 67ffff38edb250bb530549d1caeec4f9ee20b861 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Thu, 21 Nov 2019 13:57:42 +0100 Subject: [PATCH] mgr: fix errors on using a reference in a Lambda function This is the extra info on this matter: https://bugs.llvm.org/show_bug.cgi?id=35984. Fixes: https://tracker.ceph.com/issues/42905 Signed-off-by: Willem Jan Withagen --- src/mgr/ActivePyModules.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 2d4ecf1cf56c7..6cb62910d502b 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -480,8 +480,10 @@ void ActivePyModules::notify_all(const std::string ¬ify_type, // Send all python calls down a Finisher to avoid blocking // C++ code, and avoid any potential lock cycles. dout(15) << "queuing notify to " << name << dendl; - finisher.queue(new LambdaContext([module, notify_type, notify_id](int r){ - module->notify(notify_type, notify_id); + // workaround for https://bugs.llvm.org/show_bug.cgi?id=35984 + finisher.queue(new LambdaContext([module=module, notify_type, notify_id] + (int r){ + module->notify(notify_type, notify_id); })); } } @@ -499,7 +501,8 @@ void ActivePyModules::notify_all(const LogEntry &log_entry) // log_entry: we take a copy because caller's instance is // probably ephemeral. dout(15) << "queuing notify (clog) to " << name << dendl; - finisher.queue(new LambdaContext([module, log_entry](int r){ + // workaround for https://bugs.llvm.org/show_bug.cgi?id=35984 + finisher.queue(new LambdaContext([module=module, log_entry](int r){ module->notify_clog(log_entry); })); } @@ -991,9 +994,10 @@ void ActivePyModules::config_notify() // Send all python calls down a Finisher to avoid blocking // C++ code, and avoid any potential lock cycles. dout(15) << "notify (config) " << name << dendl; - finisher.queue(new LambdaContext([module](int r){ - module->config_notify(); - })); + // workaround for https://bugs.llvm.org/show_bug.cgi?id=35984 + finisher.queue(new LambdaContext([module=module](int r){ + module->config_notify(); + })); } } -- 2.39.5