You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2013/03/03 04:54:22 UTC

git commit: Thrift-1264:TSocketClient is queried by run loop after deallocation in Cocoa Client: cocoa Patch: Jan Ruth

Updated Branches:
  refs/heads/master 5b0c59096 -> 04f83112f


Thrift-1264:TSocketClient is queried by run loop after deallocation in Cocoa
Client: cocoa
Patch: Jan Ruth

Fixes TSocketClient not deallocated correctly.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/04f83112
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/04f83112
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/04f83112

Branch: refs/heads/master
Commit: 04f83112f6a84d5f572921990adf4b122e15d377
Parents: 5b0c590
Author: Jake Farrell <jf...@apache.org>
Authored: Sat Mar 2 22:51:55 2013 -0500
Committer: Jake Farrell <jf...@apache.org>
Committed: Sat Mar 2 22:51:55 2013 -0500

----------------------------------------------------------------------
 lib/cocoa/src/transport/TSocketClient.m |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/04f83112/lib/cocoa/src/transport/TSocketClient.m
----------------------------------------------------------------------
diff --git a/lib/cocoa/src/transport/TSocketClient.m b/lib/cocoa/src/transport/TSocketClient.m
index 256ecf3..1a7eea8 100644
--- a/lib/cocoa/src/transport/TSocketClient.m
+++ b/lib/cocoa/src/transport/TSocketClient.m
@@ -25,13 +25,20 @@
 #import <CFNetwork/CFNetwork.h>
 #endif
 
+@interface TSocketClient ()
+{
+    NSInputStream * inputStream;
+	NSOutputStream * outputStream;
+}
+@end
+
 @implementation TSocketClient
 
 - (id) initWithHostname: (NSString *) hostname
                    port: (int) port
 {
-	NSInputStream * inputStream = NULL;
-	NSOutputStream * outputStream = NULL;
+	inputStream = NULL;
+	outputStream = NULL;
 	CFReadStreamRef readStream = NULL;
 	CFWriteStreamRef writeStream = NULL;
 	CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (bridge_stub CFStringRef)hostname, port, &readStream, &writeStream);
@@ -59,6 +66,20 @@
 	return self;
 }
 
+-(void)dealloc
+{
+    [inputStream close];
+    [inputStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+    [inputStream setDelegate:nil];
+    [inputStream release_stub];
+    
+    [outputStream close];
+    [outputStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+    [outputStream setDelegate:nil];
+    [outputStream release_stub];
+    [super dealloc_stub];
+}
+
 
 @end