git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
Aug 6, 2008, 03:09 UTC
Message-ID
<1217992180-5697-3-git-send-email-spearce@spearce.org>
In-Reply-To
<1217992180-5697-2-git-send-email-spearce@spearce.org>

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@spearce.org>
---
 .../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
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 3 of 6 in “Support linked resources in repositories”
  1. 0/5 Support linked resources in repositoriesShawn O. Pearce, Aug 6, 2008
  2. 1/5 Remove the pointless GitProjectData resource change listenerShawn O. Pearce, Aug 6, 2008
  3. 2/5 Don't crash the decorator update loop when resources are deletedShawn O. Pearce, Aug 6, 2008
  4. 3/5 Fix RepositoryMapping.getRepoRelativePath to honor linked resourcesShawn O. Pearce, Aug 6, 2008
  5. 4/5 Change GitProjectData.getRepositoryMapping to work on linked resourcesShawn O. Pearce, Aug 6, 2008
  6. 5/5 Correct getRepositoryMapping callers to use any IResourceShawn O. Pearce, Aug 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.