Protocol should hang onto shared pointer for protection but always use underlying...
authorMark Slee <mcslee@apache.org>
Wed, 7 Feb 2007 00:54:17 +0000 (00:54 +0000)
committerMark Slee <mcslee@apache.org>
Wed, 7 Feb 2007 00:54:17 +0000 (00:54 +0000)
Reviewed By: aditya

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664982 13f79535-47bb-0310-9956-ffa450edef68

lib/cpp/src/protocol/TProtocol.h

index 39ee39e..2ad5a57 100644 (file)
@@ -283,23 +283,26 @@ class TProtocol {
   }
 
   inline shared_ptr<TTransport> getTransport() {
-    return trans_;
+    return ptrans_;
   }
 
   // TODO: remove these two calls, they are for backwards
   // compatibility
   inline shared_ptr<TTransport> getInputTransport() {
-    return trans_;
+    return ptrans_;
   }
   inline shared_ptr<TTransport> getOutputTransport() {
-    return trans_;
+    return ptrans_;
   }
 
  protected:
-  TProtocol(shared_ptr<TTransport> trans):
-    trans_(trans) {}
+  TProtocol(shared_ptr<TTransport> ptrans):
+    ptrans_(ptrans) {
+    trans_ = ptrans.get();
+  }
     
-  shared_ptr<TTransport> trans_;
+  shared_ptr<TTransport> ptrans_;
+  TTransport* trans_;
 
  private:
   TProtocol() {}