1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 262245 - [vm] AbstractVMProvider may install the same model proxy for multiple views, resulting in the viewer not working.

This commit is contained in:
Pawel Piech 2009-01-23 21:58:57 +00:00
parent b323a0e9b8
commit 82dbef1ccc
2 changed files with 12 additions and 4 deletions

View file

@ -637,12 +637,14 @@ abstract public class AbstractVMProvider implements IVMProvider, IVMEventListene
public IModelProxy createModelProxy(Object element, IPresentationContext context) { public IModelProxy createModelProxy(Object element, IPresentationContext context) {
// Iterate through the current active proxies to try to find a proxy with the same // Iterate through the current active proxies to try to find a proxy with the same
// element and re-use it if found. At the same time purge proxies that are no longer // element and re-use it if found. Only disposed proxies can be re-used because
// multiple viewers cannot use the same proxy. Also at this time purge other proxies
// that are no longer installed.
IVMModelProxy proxy = null; IVMModelProxy proxy = null;
for (Iterator<IVMModelProxy> itr = getActiveModelProxies().iterator(); itr.hasNext();) { for (Iterator<IVMModelProxy> itr = getActiveModelProxies().iterator(); itr.hasNext();) {
IVMModelProxy next = itr.next(); IVMModelProxy next = itr.next();
if (next != null) { if (next != null) {
if (next.getRootElement().equals(element)) { if (next.getRootElement().equals(element) && next.isDisposed()) {
proxy = next; proxy = next;
} else if (next.isDisposed()) { } else if (next.isDisposed()) {
itr.remove(); itr.remove();

View file

@ -819,11 +819,17 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
@Override @Override
public IModelProxy createModelProxy(Object element, IPresentationContext context) { public IModelProxy createModelProxy(Object element, IPresentationContext context) {
// Iterate through the current active proxies to try to find a proxy with the same // Iterate through the current active proxies to try to find a proxy with the same
// element and re-use it if found. At the same time purge proxies that are no longer // element and re-use it if found. Only disposed proxies can be re-used because
// multiple viewers cannot use the same proxy.
//
// Unlike in the base class, do not remove proxies just because they were disposed
// by the viewer. These proxies can contain modification history for variables in
// their cache. The proxies will be removed once their cache entries are emptied.
// See rootElementRemovedFromCache().
IVMModelProxy proxy = null; IVMModelProxy proxy = null;
for (Iterator<IVMModelProxy> itr = getActiveModelProxies().iterator(); itr.hasNext();) { for (Iterator<IVMModelProxy> itr = getActiveModelProxies().iterator(); itr.hasNext();) {
IVMModelProxy next = itr.next(); IVMModelProxy next = itr.next();
if (next != null && next.getRootElement().equals(element)) { if (next != null && next.getRootElement().equals(element) && next.isDisposed()) {
proxy = next; proxy = next;
break; break;
} }