Author: tedross
Date: 2009-10-22 10:41:36 -0400 (Thu, 22 Oct 2009)
New Revision: 3680
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.cpp
Log:
Close out the use of management objects at finalize time rather than
in the destructor. This ensures that there won't be invalid accesses
to freed heap during the destructor on broker shutdown.
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2009-10-22 14:37:50 UTC (rev 3679)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2009-10-22 14:41:36 UTC (rev 3680)
@@ -120,8 +120,10 @@
journalTimerPtr = 0;
}
- if (_mgmtObject != 0)
+ if (_mgmtObject != 0) {
_mgmtObject->resourceDestroy();
+ _mgmtObject = 0;
+ }
::pthread_mutex_destroy(&_getf_mutex);
log(LOG_DEBUG, "Destroyed");
@@ -491,6 +493,11 @@
{
(dynamic_cast<InactivityFireEvent*>(inactivityFireEventPtr.get()))->cancel();
jcntl::stop(block_till_aio_cmpl);
+
+ if (_mgmtObject != 0) {
+ _mgmtObject->resourceDestroy();
+ _mgmtObject = 0;
+ }
}
iores
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-10-22 14:37:50 UTC (rev 3679)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-10-22 14:41:36 UTC (rev 3680)
@@ -366,6 +366,11 @@
JournalImpl* jQueue = i->second;
if (jQueue->is_ready()) jQueue->stop(true);
}
+
+ if (mgmtObject != 0) {
+ mgmtObject->resourceDestroy();
+ mgmtObject = 0;
+ }
}
void MessageStoreImpl::pushDown(const char* dirName, const char* bakDirName)
@@ -460,8 +465,10 @@
QPID_LOG(error, "Unknown error in
MessageStoreImpl::~MessageStoreImpl()");
}
- if (mgmtObject != 0)
+ if (mgmtObject != 0) {
mgmtObject->resourceDestroy();
+ mgmtObject = 0;
+ }
}
void MessageStoreImpl::create(PersistableQueue& queue,
Show replies by date