From 43b6c6378e6a56c4d5dd69164f87d470273eed40 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Wed, 7 Feb 2007 00:54:17 +0000 Subject: [PATCH] Protocol should hang onto shared pointer for protection but always use underlying raw pointer 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h index 39ee39e4..2ad5a571 100644 --- a/lib/cpp/src/protocol/TProtocol.h +++ b/lib/cpp/src/protocol/TProtocol.h @@ -283,23 +283,26 @@ class TProtocol { } inline shared_ptr getTransport() { - return trans_; + return ptrans_; } // TODO: remove these two calls, they are for backwards // compatibility inline shared_ptr getInputTransport() { - return trans_; + return ptrans_; } inline shared_ptr getOutputTransport() { - return trans_; + return ptrans_; } protected: - TProtocol(shared_ptr trans): - trans_(trans) {} + TProtocol(shared_ptr ptrans): + ptrans_(ptrans) { + trans_ = ptrans.get(); + } - shared_ptr trans_; + shared_ptr ptrans_; + TTransport* trans_; private: TProtocol() {} -- 2.17.1