Removed caching for trash and templates as it does not get correctly updated when the respective groups get deleted

This commit is contained in:
michael starke
2014-01-06 17:44:54 +01:00
parent 3385f09c2c
commit 09d5efa38e
2 changed files with 7 additions and 12 deletions

View File

@@ -158,6 +158,9 @@
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<action selector="emptyTrash:" target="-1" id="uIZ-CN-kXB"/>
</connections>
</button>
</subviews>
<constraints>

View File

@@ -313,13 +313,9 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
}
- (KPKGroup *)trash {
static KPKGroup *_trash = nil;
/* Caching is dangerous, as we might have deleted the trashcan */
if(self.useTrash) {
BOOL trashValid = [_trash.uuid isEqual:self.tree.metaData.recycleBinUuid];
if(!trashValid) {
_trash = [self findGroup:self.tree.metaData.recycleBinUuid];
}
return _trash;
return [self findGroup:self.tree.metaData.recycleBinUuid];
}
return nil;
}
@@ -329,12 +325,8 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
}
- (KPKGroup *)templates {
static KPKGroup *_templates = nil;
BOOL templateValid = [_templates.uuid isEqual:self.tree.metaData.entryTemplatesGroup];
if(!templateValid) {
_templates = [self findGroup:self.tree.metaData.entryTemplatesGroup];
}
return _templates;
/* Caching is dangerous as we might have deleted the group */
return [self findGroup:self.tree.metaData.entryTemplatesGroup];
}
- (void)setTrash:(KPKGroup *)trash {