[ 
https://issues.apache.org/jira/browse/QPID-2076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kim van der Riet updated QPID-2076:
-----------------------------------

    Attachment: steve_test_patch.txt

I tested the patch, all seems to work ok. However, the tests also need mods, 
see attached patch. The AsyncCompletion.cpp patch is a little ugly because the 
test uses a MessageStore subclass, and must access the methods of this subclass 
locally. I could not figure a way to cast this directly from a MessageStore 
smart pointer, so I left it as a raw pointer and reset a smart pointer for 
initializing the broker only. If you can come up with a better solution, please 
do.

> 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
>            Assignee: Steve Huston
>         Attachments: QPID-2076.diff, steve_test_patch.txt
>
>
> 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