summaryrefslogtreecommitdiff
path: root/cpp/bindings/qpid/dotnet/src/Session.cpp
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2011-01-10 20:43:56 +0000
committerCharles E. Rolke <chug@apache.org>2011-01-10 20:43:56 +0000
commitc95e40580ef57d5a1e36e9105ae18dbffe3c3de8 (patch)
tree9ea688597fefd0ae6ab1c42b8b99d142f42b082f /cpp/bindings/qpid/dotnet/src/Session.cpp
parent02d83427237f6929595692fa12b9a614e523ccda (diff)
downloadqpid-python-c95e40580ef57d5a1e36e9105ae18dbffe3c3de8.tar.gz
.NET Binding for Qpid Messaging, in every .NET object that keeps
a reference to unmanaged memory: * Function Cleanup() is deleted and cleanup is moved to Finalizer. * Destructor calls Finalizer. * Finalizer takes a lock before deleting unmanaged memory. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1057350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src/Session.cpp')
-rw-r--r--cpp/bindings/qpid/dotnet/src/Session.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Session.cpp b/cpp/bindings/qpid/dotnet/src/Session.cpp
index b6d00b433f..880331c588 100644
--- a/cpp/bindings/qpid/dotnet/src/Session.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Session.cpp
@@ -72,16 +72,23 @@ namespace Messaging {
// Destructor
Session::~Session()
{
- Cleanup();
+ this->!Session();
}
// Finalizer
Session::!Session()
{
- Cleanup();
+ msclr::lock lk(this);
+
+ if (NULL != sessionp)
+ {
+ delete sessionp;
+ sessionp = NULL;
+ }
}
+
// Copy constructor
Session::Session(const Session ^ session)
: parentConnectionp(session->parentConnectionp)
@@ -107,17 +114,6 @@ namespace Messaging {
}
- // Destroys kept object
- // TODO: add lock
- void Session::Cleanup()
- {
- if (NULL != sessionp)
- {
- delete sessionp;
- sessionp = NULL;
- }
- }
-
void Session::Close()
{
System::Exception ^ newException = nullptr;