[EGIT PATCH 2/5] Don't crash the decorator update loop when resources are deleted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <spearce@xxxxxxxxxxx>
---
 .../internal/decorators/GitResourceDecorator.java  |   11 +++++++++--
 1 files changed, 9 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 6d2f88e..84ad949 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
@@ -126,6 +126,14 @@ public class GitResourceDecorator extends LabelProvider implements
 						Iterator<IResource> 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 +196,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));
 	}
 
-- 
1.6.0.rc1.250.g9b5e2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux