From 3f916b19723fa5f38d881644142b809ac627297a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 1 Mar 2018 15:06:28 +0100 Subject: [PATCH] Make a copy of listeners list before calling them in C++ wrapper so that the list can be modified in these listeners. --- wrappers/cpp/class_impl.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrappers/cpp/class_impl.mustache b/wrappers/cpp/class_impl.mustache index e98acedfa..3002c3c9c 100644 --- a/wrappers/cpp/class_impl.mustache +++ b/wrappers/cpp/class_impl.mustache @@ -38,7 +38,7 @@ static {{{returnType}}} {{{cbName}}}({{{declArgs}}}) { {{#ismultilistenable}} {{{cListenerName}}} *cbs = {{{currentCallbacksGetter}}}({{{firstArgName}}}); - std::list > &listeners = *(std::list > *){{{userDataGetter}}}(cbs); + std::list > listeners = *(std::list > *){{{userDataGetter}}}(cbs); for(auto it=listeners.begin(); it!=listeners.end(); it++) { std::shared_ptr<{{{cppListenerName}}}> listener = std::static_pointer_cast<{{{cppListenerName}}},Listener>(*it); {{{cppMethodCallingLine}}};