mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42: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:
parent
b323a0e9b8
commit
82dbef1ccc
2 changed files with 12 additions and 4 deletions
|
@ -637,12 +637,14 @@ abstract public class AbstractVMProvider implements IVMProvider, IVMEventListene
|
|||
public IModelProxy createModelProxy(Object element, IPresentationContext context) {
|
||||
|
||||
// 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;
|
||||
for (Iterator<IVMModelProxy> itr = getActiveModelProxies().iterator(); itr.hasNext();) {
|
||||
IVMModelProxy next = itr.next();
|
||||
if (next != null) {
|
||||
if (next.getRootElement().equals(element)) {
|
||||
if (next.getRootElement().equals(element) && next.isDisposed()) {
|
||||
proxy = next;
|
||||
} else if (next.isDisposed()) {
|
||||
itr.remove();
|
||||
|
|
|
@ -819,11 +819,17 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
|
|||
@Override
|
||||
public IModelProxy createModelProxy(Object element, IPresentationContext context) {
|
||||
// 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;
|
||||
for (Iterator<IVMModelProxy> itr = getActiveModelProxies().iterator(); itr.hasNext();) {
|
||||
IVMModelProxy next = itr.next();
|
||||
if (next != null && next.getRootElement().equals(element)) {
|
||||
if (next != null && next.getRootElement().equals(element) && next.isDisposed()) {
|
||||
proxy = next;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue