[rhmessaging-commits] rhmessaging commits: r3995 - store/trunk/cpp/lib.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu May 27 14:06:48 EDT 2010


Author: aconway
Date: 2010-05-27 14:06:48 -0400 (Thu, 27 May 2010)
New Revision: 3995

Modified:
   store/trunk/cpp/lib/MessageStoreImpl.cpp
   store/trunk/cpp/lib/StorePlugin.cpp
Log:
Bug 596765: Remove global shared_ptr to store in store plugin.

The global shared_ptr delays destruction of the store till after the broker is deleted causing core dumps when unregistering management objects.
https://bugzilla.redhat.com/show_bug.cgi?id=596765


Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp	2010-05-26 20:46:43 UTC (rev 3994)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp	2010-05-27 18:06:48 UTC (rev 3995)
@@ -428,11 +428,11 @@
 
 MessageStoreImpl::~MessageStoreImpl()
 {
+    finalize();
     try {
         for (std::list<db_ptr >::iterator i = dbs.begin(); i != dbs.end(); i++) {
             (*i)->close(0);
         }
-//        if (tplStorePtr->is_ready()) tplStorePtr->stop(true);
     } catch (const DbException& e) {
         QPID_LOG(error, "Error closing BDB databases: " <<  e.what());
     } catch (const journal::jexception& e) {

Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp	2010-05-26 20:46:43 UTC (rev 3994)
+++ store/trunk/cpp/lib/StorePlugin.cpp	2010-05-27 18:06:48 UTC (rev 3995)
@@ -36,16 +36,15 @@
 struct StorePlugin : public Plugin {
 
     mrg::msgstore::MessageStoreImpl::StoreOptions options;
-    boost::shared_ptr<qpid::broker::MessageStore> store;
 
     Options* getOptions() { return &options; }
 
     void earlyInitialize (Plugin::Target& target)
     {
         Broker* broker = dynamic_cast<Broker*>(&target);
-        store.reset(new mrg::msgstore::MessageStoreImpl ());
+        if (!broker) return;
+        boost::shared_ptr<qpid::broker::MessageStore> store(new mrg::msgstore::MessageStoreImpl ());
         DataDir& dataDir = broker->getDataDir ();
-
         if (options.storeDir.empty ())
         {
             if (!dataDir.isEnabled ())
@@ -67,8 +66,7 @@
 
     void finalize()
     {
-        MessageStore* sp = store.get();
-        static_cast<mrg::msgstore::MessageStoreImpl*>(sp)->finalize();
+        // This function intentionally left blank
     }
 
     const char* id() {return "StorePlugin";}



More information about the rhmessaging-commits mailing list