From 4a230ea18a898edc36406b26fa442eaf343c3fa6 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 9 Aug 2008 23:39:43 -0700 Subject: [PATCH] Don't crash the decorator update loop when resources are deleted If a resource is deleted from the workspace we don't need to clear its GITFOLDERDIRTYSTATEPROPERTY from the item because it is gone. There won't be anyone else to query for that flag, so the flag is not relevant anymore. Further trying to call accept() on those resources throws an exception because Eclipse won't let you touch a deleted resource. Signed-off-by: Shawn O. Pearce --- .../egit/ui/internal/decorators/GitResourceDecorator.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java index 6d2f88ec..5857eafd 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java @@ -2,6 +2,7 @@ * Copyright (C) 2007, Dave Watson * Copyright (C) 2008, Robin Rosenberg * Copyright (C) 2008, Shawn O. Pearce + * Copyright (C) 2008, Google Inc. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -126,6 +127,14 @@ public class GitResourceDecorator extends LabelProvider implements Iterator i = resources.iterator(); m = i.next(); i.remove(); + + while (!m.isAccessible()) { + if (!i.hasNext()) + return Status.OK_STATUS; + m = i.next(); + i.remove(); + } + if (resources.size() > 0) schedule(); } @@ -188,8 +197,7 @@ public class GitResourceDecorator extends LabelProvider implements } // End ResCL void clearDecorationState(IResource r) throws CoreException { - if (r.isAccessible()) - r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); + r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); } -- 2.11.4.GIT