summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-11-06 13:30:27 +0000
committerGordon Sim <gsim@apache.org>2008-11-06 13:30:27 +0000
commitfebbe7f16f4601037a31aaaf9684d0b4921c9655 (patch)
tree0204d28d0437b0f5a6c448e785e6c61352725e59 /qpid/cpp
parenta7e0979a56f05501e5465daf045d653a99977333 (diff)
downloadqpid-python-febbe7f16f4601037a31aaaf9684d0b4921c9655.tar.gz
QPID-1417: ensure there are no dangling pointers in a connections output tasks
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@711855 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/broker/Connection.cpp2
-rw-r--r--qpid/cpp/src/qpid/sys/AggregateOutput.cpp5
-rw-r--r--qpid/cpp/src/qpid/sys/AggregateOutput.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/broker/Connection.cpp b/qpid/cpp/src/qpid/broker/Connection.cpp
index 47ad8f74b7..28ab6cbf1b 100644
--- a/qpid/cpp/src/qpid/broker/Connection.cpp
+++ b/qpid/cpp/src/qpid/broker/Connection.cpp
@@ -169,6 +169,8 @@ void Connection::close(
{
QPID_LOG_IF(error, code != 200, "Connection " << mgmtId << " closed by error: " << text << "(" << code << ")");
adapter.close(code, text, classId, methodId);
+ //make sure we delete dangling pointers from outputTasks before deleting sessions
+ outputTasks.removeAll();
channels.clear();
getOutput().close();
}
diff --git a/qpid/cpp/src/qpid/sys/AggregateOutput.cpp b/qpid/cpp/src/qpid/sys/AggregateOutput.cpp
index 2fad28c381..d2c4b7185e 100644
--- a/qpid/cpp/src/qpid/sys/AggregateOutput.cpp
+++ b/qpid/cpp/src/qpid/sys/AggregateOutput.cpp
@@ -65,4 +65,9 @@ void AggregateOutput::removeOutputTask(OutputTask* t)
if (i != tasks.end()) tasks.erase(i);
}
+void AggregateOutput::removeAll()
+{
+ tasks.clear();
+}
+
}} // namespace qpid::sys
diff --git a/qpid/cpp/src/qpid/sys/AggregateOutput.h b/qpid/cpp/src/qpid/sys/AggregateOutput.h
index 0b08cd6f5f..9655e28c6a 100644
--- a/qpid/cpp/src/qpid/sys/AggregateOutput.h
+++ b/qpid/cpp/src/qpid/sys/AggregateOutput.h
@@ -48,6 +48,7 @@ namespace sys {
bool hasOutput();
void addOutputTask(OutputTask* t);
void removeOutputTask(OutputTask* t);
+ void removeAll();
/** Apply f to each OutputTask* in the tasks list */
template <class F> void eachOutput(F f) {