summaryrefslogtreecommitdiff
path: root/cpp/bindings/qpid/dotnet/src/Connection.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2010-08-20 13:58:20 +0000
committerTed Ross <tross@apache.org>2010-08-20 13:58:20 +0000
commit5269fc0e04984b2d196d5eaf96e206e034d21184 (patch)
tree2c5c273773ce707de712e7691a00003639c0f281 /cpp/bindings/qpid/dotnet/src/Connection.cpp
parentfdfefb5e9721cb85d70a81928044f61b7f48ccf3 (diff)
downloadqpid-python-5269fc0e04984b2d196d5eaf96e206e034d21184.tar.gz
QPID-2798 - C++ Messaging Client .NET binding fails to clone managed objects correctly
Patch from Chuck Rolke git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@987510 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings/qpid/dotnet/src/Connection.cpp')
-rw-r--r--cpp/bindings/qpid/dotnet/src/Connection.cpp39
1 files changed, 6 insertions, 33 deletions
diff --git a/cpp/bindings/qpid/dotnet/src/Connection.cpp b/cpp/bindings/qpid/dotnet/src/Connection.cpp
index 50755302f3..322910d820 100644
--- a/cpp/bindings/qpid/dotnet/src/Connection.cpp
+++ b/cpp/bindings/qpid/dotnet/src/Connection.cpp
@@ -132,16 +132,13 @@ namespace Messaging {
Session ^ Connection::CreateTransactionalSession(System::String ^ name)
{
System::Exception ^ newException = nullptr;
- ::qpid::messaging::Session * sessionp = NULL;
Session ^ newSession = nullptr;
try
{
- // allocate native session
- sessionp = new ::qpid::messaging::Session ;
-
// create native session
- *sessionp = connectionp->createTransactionalSession(QpidMarshal::ToNative(name));
+ ::qpid::messaging::Session sessionp =
+ connectionp->createTransactionalSession(QpidMarshal::ToNative(name));
// create managed session
newSession = gcnew Session(sessionp, this);
@@ -160,13 +157,6 @@ namespace Messaging {
{
delete newSession;
}
- else
- {
- if (sessionp != NULL)
- {
- delete sessionp;
- }
- }
}
}
@@ -191,16 +181,13 @@ namespace Messaging {
Session ^ Connection::CreateSession(System::String ^ name)
{
System::Exception ^ newException = nullptr;
- ::qpid::messaging::Session * sessionp = NULL;
Session ^ newSession = nullptr;
try
{
- // allocate native session
- sessionp = new ::qpid::messaging::Session ;
-
// create native session
- *sessionp = connectionp->createSession(QpidMarshal::ToNative(name));
+ ::qpid::messaging::Session sessionp =
+ connectionp->createSession(QpidMarshal::ToNative(name));
// create managed session
newSession = gcnew Session(sessionp, this);
@@ -219,13 +206,6 @@ namespace Messaging {
{
delete newSession;
}
- else
- {
- if (sessionp != NULL)
- {
- delete sessionp;
- }
- }
}
}
@@ -241,14 +221,14 @@ namespace Messaging {
Session ^ Connection::GetSession(System::String ^ name)
{
System::Exception ^ newException = nullptr;
- ::qpid::messaging::Session * sess = NULL;
Session ^ newSession = nullptr;
try
{
const std::string n = QpidMarshal::ToNative(name);
- *sess = connectionp->::qpid::messaging::Connection::getSession(n);
+ ::qpid::messaging::Session sess =
+ connectionp->::qpid::messaging::Connection::getSession(n);
newSession = gcnew Session(sess, this);
}
@@ -266,13 +246,6 @@ namespace Messaging {
{
delete newSession;
}
- else
- {
- if (sess != NULL)
- {
- delete sess;
- }
- }
}
}