Work around crash-on-close by temporarily retaining the connection object.
authorJens Alfke <jens@mooseyard.com>
Thu Jun 19 10:22:19 2008 -0700 (2008-06-19)
changeset 1770590cc555aa
parent 16 6f608b552b77
child 18 3be241de1630
Work around crash-on-close by temporarily retaining the connection object.
TCP/TCPConnection.m
     1.1 --- a/TCP/TCPConnection.m	Wed Jun 11 14:58:38 2008 -0700
     1.2 +++ b/TCP/TCPConnection.m	Thu Jun 19 10:22:19 2008 -0700
     1.3 @@ -264,6 +264,7 @@
     1.4  // called by my streams when they close (after my -close is called)
     1.5  - (void) _closed
     1.6  {
     1.7 +    [[self retain] autorelease];
     1.8      if( _status != kTCP_Closed && _status != kTCP_Disconnected ) {
     1.9          LogTo(TCP,@"%@ is now closed",self);
    1.10          TCPConnectionStatus prevStatus = _status;
    1.11 @@ -352,6 +353,7 @@
    1.12  {
    1.13      LogTo(TCP,@"%@ got %@ on %@",self,error,stream.class);
    1.14      Assert(error);
    1.15 +    [[self retain] autorelease];
    1.16      setObj(&_error,error);
    1.17      [_reader disconnect];
    1.18      setObj(&_reader,nil);