Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-09-10 11:34:46 +0000
committerUwe Stieber2013-09-10 11:38:18 +0000
commit41332ef951a3c7184d2a6d0c8fe65afc79081ae0 (patch)
tree457a83f37ef9da6c2533008d935778016e9f286a /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch
parentf219b36b888088e50eea3047b7f3671dcf4b90b0 (diff)
downloadorg.eclipse.tcf-41332ef951a3c7184d2a6d0c8fe65afc79081ae0.tar.gz
org.eclipse.tcf-41332ef951a3c7184d2a6d0c8fe65afc79081ae0.tar.xz
org.eclipse.tcf-41332ef951a3c7184d2a6d0c8fe65afc79081ae0.zip
Target Explorer: Fix illegal thread access in path map service implementation for applyPathMap
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java36
1 files changed, 21 insertions, 15 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
index 9b25fd2e1..f6d3fee06 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
@@ -272,16 +272,22 @@ public class PathMapService extends AbstractService implements IPathMapService {
final IChannel channel = Tcf.getChannelManager().getChannel(peer);
if (channel != null && IChannel.STATE_OPEN == channel.getState()) {
// Channel is open -> Have to update the path maps
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- final IPathMap svc = channel.getRemoteService(IPathMap.class);
- if (svc != null) {
- final PathMapRule[] configuredMap = getPathMap(context);
- if (configuredMap != null && configuredMap.length > 0) {
+
+ // Get the configured path mappings. This must be called from
+ // outside the runnable as getPathMap(...) must be called from
+ // outside of the TCF dispatch thread.
+ final PathMapRule[] configuredMap = getPathMap(context);
+
+ if (configuredMap != null && configuredMap.length > 0) {
+ // Create the runnable which set the path map
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ final IPathMap svc = channel.getRemoteService(IPathMap.class);
+ if (svc != null) {
// Get the old path maps first. Keep path map rules not coming from us
svc.get(new IPathMap.DoneGet() {
- @Override
+ @Override
public void doneGet(IToken token, Exception error, PathMapRule[] map) {
// Merge the maps to a new list
List<PathMapRule> rules = new ArrayList<PathMapRule>();
@@ -303,20 +309,20 @@ public class PathMapService extends AbstractService implements IPathMapService {
}
});
} else {
- callback.done(PathMapService.this, Status.OK_STATUS);
+ callback.done(PathMapService.this, Status.OK_STATUS);
}
}
});
} else {
- callback.done(PathMapService.this, Status.OK_STATUS);
+ callback.done(PathMapService.this, Status.OK_STATUS);
}
- } else {
- callback.done(PathMapService.this, Status.OK_STATUS);
}
- }
- };
+ };
- Protocol.invokeLater(runnable);
+ Protocol.invokeLater(runnable);
+ } else {
+ callback.done(PathMapService.this, Status.OK_STATUS);
+ }
} else {
callback.done(PathMapService.this, Status.OK_STATUS);
}

Back to the top