Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2012-06-04 20:38:14 +0000
committerMatthias Sohn2012-06-04 20:38:14 +0000
commitf0d77b4e01d6e8f50b4c897288c1a73c165d4a32 (patch)
treebb7aa4050363e8780ccf1d7e3d9f67f1cdf531c4
parentd3a6b1e63166b1a7036c2f268ed5644183ec9959 (diff)
downloadegit-f0d77b4e01d6e8f50b4c897288c1a73c165d4a32.tar.gz
egit-f0d77b4e01d6e8f50b4c897288c1a73c165d4a32.tar.xz
egit-f0d77b4e01d6e8f50b4c897288c1a73c165d4a32.zip
[repoView] Release RevWalks used in label provider
Change-Id: Ibb5e800f7dd6915bc19d63f6bf0bf6d4143449ba Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java
index aa2cfc9dbe..2a1d951595 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java
@@ -96,18 +96,21 @@ public class RepositoriesViewLabelProvider extends GitLabelProvider implements
// determine if we have a lightweight tag and
// use the corresponding icon
RevObject any;
+ RevWalk walk = new RevWalk(node.getRepository());
try {
ObjectId id = node.getRepository().resolve(
((Ref) node.getObject()).getName());
if (id == null)
return null;
- any = new RevWalk(node.getRepository()).parseAny(id);
+ any = walk.parseAny(id);
} catch (MissingObjectException e) {
Activator.logError(e.getMessage(), e);
return null;
} catch (IOException e) {
Activator.logError(e.getMessage(), e);
return null;
+ } finally {
+ walk.release();
}
if (any instanceof RevTag)
return decorateImage(annotatedTagImage, element);
@@ -185,6 +188,8 @@ public class RepositoriesViewLabelProvider extends GitLabelProvider implements
} catch (IncorrectObjectTypeException e) {
// Ref is a lightweight tag, not an annotated tag
compareString = id.name();
+ } finally {
+ rw.release();
}
} else if (refName.startsWith(Constants.R_REMOTES)) {
// remote branch: HEAD would be on the commit id to which
@@ -193,8 +198,12 @@ public class RepositoriesViewLabelProvider extends GitLabelProvider implements
if (id == null)
return image;
RevWalk rw = new RevWalk(node.getRepository());
- RevCommit commit = rw.parseCommit(id);
- compareString = commit.getId().name();
+ try {
+ RevCommit commit = rw.parseCommit(id);
+ compareString = commit.getId().name();
+ } finally {
+ rw.release();
+ }
} else if (refName.equals(Constants.HEAD))
return getDecoratedImage(image);
else {
@@ -318,6 +327,8 @@ public class RepositoriesViewLabelProvider extends GitLabelProvider implements
StyledString.QUALIFIER_STYLER);
} catch (IOException ignored) {
// Ignored
+ } finally {
+ walk.release();
}
}
}

Back to the top