diff options
author | Uwe Stieber | 2014-07-23 09:56:04 +0000 |
---|---|---|
committer | Uwe Stieber | 2014-07-23 09:56:47 +0000 |
commit | ea80517f61bcb481d274e04804610868079654f0 (patch) | |
tree | dc8a6e84e15de467dc8466803c42efd87b286534 /target_explorer | |
parent | 12baf1ef574d960283c5cbfbcc80d7494bedc06a (diff) | |
download | org.eclipse.tcf-ea80517f61bcb481d274e04804610868079654f0.tar.gz org.eclipse.tcf-ea80517f61bcb481d274e04804610868079654f0.tar.xz org.eclipse.tcf-ea80517f61bcb481d274e04804610868079654f0.zip |
Target Explorer: Fix illegal thread access issue in path map service
Diffstat (limited to 'target_explorer')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java | 16 |
1 files changed, 14 insertions, 2 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 39e4f5290..16d25d370 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 @@ -16,6 +16,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -319,9 +320,20 @@ public class PathMapService extends AbstractService implements IPathMapService { // If called as part of the "open channel" step group, IChannelManager.getChannel(peer) // will return null. For this case, the channel to use is passed as context directly. - IChannel channel = context instanceof IChannel ? (IChannel)context : null; + final IChannel channel = context instanceof IChannel ? (IChannel)context : null; // The peer in that case is the remote peer of the channel - if (peer == null && channel != null) peer = channel.getRemotePeer(); + if (peer == null && channel != null) { + final AtomicReference<IPeer> remotePeer = new AtomicReference<IPeer>(); + + Protocol.invokeAndWait(new Runnable() { + @Override + public void run() { + remotePeer.set(channel.getRemotePeer()); + } + }); + + peer = remotePeer.get(); + } // Make sure that the callback is invoked in the TCF dispatch thread final AsyncCallbackCollector collector = new AsyncCallbackCollector(callback, new CallbackInvocationDelegate()); |