CMSException::what returns c_str of temporary std::string
---------------------------------------------------------

                 Key: AMQCPP-61
                 URL: https://issues.apache.org/activemq/browse/AMQCPP-61
             Project: ActiveMQ C++ Client
          Issue Type: Bug
          Components: CMS Impl
    Affects Versions: 2.0
            Reporter: Albert Strasheim
         Assigned To: Nathan Mittler
            Priority: Minor
             Fix For: 2.0


In my debugging to figure out what's going on with AMQCPP-59, I'm sometimes 
seeing invalid stuff getting printed out when I do printStackTrace on some 
exceptions. I think this might be because CMSException::what returns 
getMessage().c_str(), i.e. it seems to be returning the c_str of a std::string 
that is allocated on the stack, since getMessage returns std::string.

An example of where what() is being called that seems to be causing problems is 
on line 84 of ActiveMQConsumer.cpp. When I catch this exception later on and 
print its stack trace or call its getMessage, I get garbage.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to