From 18871fdd7bbfb43eb0971ee358554f321f789eee Mon Sep 17 00:00:00 2001 From: randomguy3 Date: Tue, 17 Jan 2012 18:14:07 +0000 Subject: Don't crash git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@387 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64 --- tikzit/src/common/Graph.m | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'tikzit/src') diff --git a/tikzit/src/common/Graph.m b/tikzit/src/common/Graph.m index e83a99c..8bf8dfa 100644 --- a/tikzit/src/common/Graph.m +++ b/tikzit/src/common/Graph.m @@ -465,7 +465,7 @@ } } } - + [graphLock unlock]; } @@ -481,16 +481,16 @@ - (Graph*)copyOfSubgraphWithNodes:(NSSet*)nds { [graphLock lock]; - + NSMapTable *newNds = [Graph nodeTableForNodes:nds]; Graph* newGraph = [[Graph graph] retain]; - + NSEnumerator *en = [newNds objectEnumerator]; Node *nd; while ((nd = [en nextObject])) { [newGraph addNode:nd]; } - + en = [edges objectEnumerator]; Edge *e; while ((e = [en nextObject])) { @@ -502,20 +502,20 @@ [e1 release]; // e1 belongs to newGraph } } - + [graphLock unlock]; - + return newGraph; } - (NSSet*)pathCover { [self sync]; - NSMutableSet *remainingEdges = [NSMutableSet setWithArray:edges]; NSMutableSet *cover = [NSMutableSet set]; - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSMutableSet *remainingEdges = [NSMutableSet setWithArray:edges]; + while ([remainingEdges count] != 0) { NSMutableArray *path = [[NSMutableArray alloc] init]; NSSet *succs; @@ -542,7 +542,6 @@ } [pool drain]; - [remainingEdges release]; return cover; } -- cgit v1.2.3