aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-11-05 16:02:57 -0800
committerScott Jackson <daneren2005@gmail.com>2014-11-05 16:02:57 -0800
commitf5e89a8b20f092a8986168dba5e9e0a4c3e58c46 (patch)
tree38c4373692b8c273890116824992b440fffdf5fd
parenta1ffd954c2b1d0a4907424187ea8b7db3f697e02 (diff)
downloaddsub-f5e89a8b20f092a8986168dba5e9e0a4c3e58c46.tar.gz
dsub-f5e89a8b20f092a8986168dba5e9e0a4c3e58c46.tar.bz2
dsub-f5e89a8b20f092a8986168dba5e9e0a4c3e58c46.zip
Fix crash when adding new device on separate thread
-rw-r--r--src/github/daneren2005/dsub/provider/DLNARouteProvider.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
index d4109a36..ccd192eb 100644
--- a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
+++ b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
@@ -42,10 +42,12 @@ import org.teleal.cling.model.meta.LocalDevice;
import org.teleal.cling.model.meta.RemoteDevice;
import org.teleal.cling.model.meta.StateVariable;
import org.teleal.cling.model.meta.StateVariableAllowedValueRange;
+import org.teleal.cling.model.types.ServiceType;
import org.teleal.cling.registry.Registry;
import org.teleal.cling.registry.RegistryListener;
import org.teleal.cling.support.renderingcontrol.callback.GetVolume;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -66,7 +68,7 @@ public class DLNARouteProvider extends MediaRouteProvider {
private RemoteController controller;
private HashMap<String, DLNADevice> devices = new HashMap<String, DLNADevice>();
- private List<String> adding = new List<String>();
+ private List<String> adding = new ArrayList<String>();
private AndroidUpnpService dlnaService;
private ServiceConnection dlnaServiceConnection;
@@ -216,7 +218,12 @@ public class DLNARouteProvider extends MediaRouteProvider {
DLNADevice newDevice = new DLNADevice(id, name, displayName, currentVolume, maxVolume);
devices.put(id, newDevice);
- broadcastDescriptors();
+ downloadService.post(new Runnable() {
+ @Override
+ public void run() {
+ broadcastDescriptors();
+ }
+ });
adding.remove(id);
}