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"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
</buttonCell> </buttonCell>
<connections>
<action selector="emptyTrash:" target="-1" id="uIZ-CN-kXB"/>
</connections>
</button> </button>
</subviews> </subviews>
<constraints> <constraints>

View File

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