|
From: <br...@us...> - 2016-07-14 17:22:25
|
Revision: 4183
http://sourceforge.net/p/openlcb/svn/4183
Author: bracz
Date: 2016-07-14 17:22:22 +0000 (Thu, 14 Jul 2016)
Log Message:
-----------
Fixes crash due to multiple calls to the onError callback.
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/can/impl/OlcbConnection.java
Modified: trunk/prototypes/java/src/org/openlcb/can/impl/OlcbConnection.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/can/impl/OlcbConnection.java 2016-07-14 17:22:04 UTC (rev 4182)
+++ trunk/prototypes/java/src/org/openlcb/can/impl/OlcbConnection.java 2016-07-14 17:22:22 UTC (rev 4183)
@@ -62,13 +62,17 @@
private Runnable mOnError = new Runnable() {
@Override
public void run() {
- outputHub.removeEntry(output);
- listenerProxy.onDisconnect();
- shutdown();
+ synchronized(OlcbConnection.this) {
+ if (outputHub != null) {
+ outputHub.removeEntry(output);
+ }
+ listenerProxy.onDisconnect();
+ shutdown();
+ }
}
};
- private void connect() {
+ private synchronized void connect() {
this.inputHub = new CanFrameHub();
this.outputHub = new CanFrameHub();
listenerProxy.onConnectionPending();
@@ -102,7 +106,7 @@
lastConnection = this;
}
- public void shutdown() {
+ public synchronized void shutdown() {
if (inputHub != null) {
inputHub.clear();
inputHub = null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|