GitGrapher: free pointers on dealloc

This frees the std vector and its contents on
dealloc. We also fresh up the header a bit
This commit is contained in:
Pieter de Bie
2008-11-25 17:38:22 +01:00
parent 18954b4a30
commit b4c2a4f3fa
2 changed files with 12 additions and 10 deletions
+4 -6
View File
@@ -12,15 +12,13 @@
#import "PBGraphCellInfo.h"
@interface PBGitGrapher : NSObject {
PBGraphCellInfo* previous;
PBGraphCellInfo *previous;
void *pl;
void *storage;
int curLane;
NSDictionary* refs;
PBGitRepository* repository;
NSDictionary *refs;
}
- (id) initWithRepository: (PBGitRepository*) repo;
- (void) decorateCommit: (PBGitCommit *) commit;
- (id) initWithRepository:(PBGitRepository *)repo;
- (void) decorateCommit:(PBGitCommit *)commit;
@end
+8 -4
View File
@@ -25,12 +25,9 @@ using namespace std;
- (id) initWithRepository: (PBGitRepository*) repo
{
refs = repo.refs;
repository = repo;
pl = new std::list<PBGitLane>;
pl = new std::list<PBGitLane *>;
PBGitLane::resetColors();
//[PBGitLane resetColors];
return self;
}
@@ -161,6 +158,13 @@ void add_line(struct PBGitGraphLine *lines, int *nLines, int upper, int from, in
- (void) finalize
{
std::list<PBGitLane *> *lanes = (std::list<PBGitLane *> *)pl;
std::list<PBGitLane *>::iterator it = lanes->begin();
for (; it != lanes->end(); ++it)
delete *it;
delete lanes;
[super finalize];
}
@end