From f0d7b8642b5380ac92279c761b6177ddd04034c6 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 27 May 2002 01:37:07 +0000 Subject: [PATCH] Need to ensure that we don't claim that the communicator is gone until after both the reader and writer have exited (otherwise the reader could exit before the writer which would result in the client chucking its reference to the communicator which could subsequently bite us in the ass if anyone tried to reference the client's distributed object manager when the writer finally exited and triggered all of the clientDidLogoff callbacks). Multithreaded programming is fun! git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1396 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/presents/client/Communicator.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/java/com/threerings/presents/client/Communicator.java b/src/java/com/threerings/presents/client/Communicator.java index f26dec782..8421e19f3 100644 --- a/src/java/com/threerings/presents/client/Communicator.java +++ b/src/java/com/threerings/presents/client/Communicator.java @@ -1,5 +1,5 @@ // -// $Id: Communicator.java,v 1.18 2002/05/15 23:54:34 mdb Exp $ +// $Id: Communicator.java,v 1.19 2002/05/27 01:37:07 mdb Exp $ package com.threerings.presents.client; @@ -200,7 +200,9 @@ public class Communicator _reader = null; // let the client know when we finally go away - _client.communicatorDidExit(); + if (_writer == null) { + _client.communicatorDidExit(); + } Log.debug("Reader thread exited."); } @@ -226,6 +228,11 @@ public class Communicator // let the client observers know that we're logged off _client.notifyObservers(Client.CLIENT_DID_LOGOFF, null); + + // let the client know when we finally go away + if (_reader == null) { + _client.communicatorDidExit(); + } } /**