C++ Broker assumes it can delete a pointer passed by message store plugin
-------------------------------------------------------------------------

                 Key: QPID-2076
                 URL: https://issues.apache.org/jira/browse/QPID-2076
             Project: Qpid
          Issue Type: Bug
          Components: C++ Broker
    Affects Versions: 0.5
            Reporter: Steve Huston


The 0.5 broker/message-store plugin arrangement has the plugin allocating an 
object derived from MessageStore and calling 
qpid::broker::Broker::setStore(MessageStore*) to allow the broker's normal 
operation to invoke methods through the pointer.

The passed MessageStore pointer is stored in a std::auto_ptr and the Broker 
destruction deletes the store. This is not valid in all cases. Particularly, on 
Windows, different DLLs can have different heaps. Memory allocated in one DLL 
(such as a plugin) can often not be deleted from a different DLL or executable 
(such as the broker) - it looks like freeing memory which was never allocated.

It also may be desireable in some cases to pass a pointer to 
qpid::broker::Broker::setStore() that is not dynamically allocated.

I propose changing the store pointer in qpid::broker::Broker from std::auto_ptr 
to boost::shared_ptr - this will allow the constructing DLL to control if, 
when, and how the memory is released.

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


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to