From 7ef869a6d2b19ec8ee6fa090c370182204f7d5ca Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 12 Aug 2016 23:25:49 +0200 Subject: [PATCH] fix an invalid access --- examples/s4u/launching/s4u_launching.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/s4u/launching/s4u_launching.cpp b/examples/s4u/launching/s4u_launching.cpp index 3c9b931486..39f8d14538 100644 --- a/examples/s4u/launching/s4u_launching.cpp +++ b/examples/s4u/launching/s4u_launching.cpp @@ -35,20 +35,20 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_launching_test, "The logging channel used in th */ class Sender { public: - const char *msg = "GaBuZoMeu"; + std::string msg = "GaBuZoMeu"; Sender() { /* Constructor used when no parameter is passed to the actor */ }; Sender(std::vector args) { /* This constructor is used when we pass parameters to the actor */ if (args.size() > 0) - msg = args[0].c_str(); + msg = args[0]; } void operator()() { XBT_INFO("Hello s4u, I have something to send"); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mb42"); - simgrid::s4u::this_actor::send(mailbox, xbt_strdup(msg), strlen(msg)); + simgrid::s4u::this_actor::send(mailbox, xbt_strdup(msg.c_str()), msg.size()); XBT_INFO("I'm done. See you."); } }; -- 2.20.1