summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-14 04:24:07 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-14 05:09:12 -0700
commitc33064f11c970d957b1d1f9afb00f91cda5dcacc (patch)
tree68979e746c86520bd78ed406e620d7ce63a78338
parentbe64dfbf168a195d2c160f3aa39efa2c03b26c19 (diff)
SourcesController should be era locked.
-rw-r--r--MobileCydia.mm13
1 files changed, 11 insertions, 2 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 9dc0619..42053dd 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -8131,6 +8131,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
UITableViewDelegate
> {
_transient Database *database_;
+ unsigned era_;
+
_H<UITableView, 2> list_;
_H<NSMutableArray> sources_;
int offset_;
@@ -8195,8 +8197,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (Source *) sourceAtIndexPath:(NSIndexPath *)indexPath {
+@synchronized (database_) {
+ if ([database_ era] != era_)
+ return nil;
+
return [sources_ objectAtIndex:[indexPath row]];
-}
+} }
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"SourceCell";
@@ -8467,6 +8473,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (void) reloadData {
[super reloadData];
+@synchronized (database_) {
+ era_ = [database_ era];
+
pkgSourceList list;
if ([database_ popErrorWithTitle:UCLocalize("SOURCES") forOperation:list.ReadMainList()])
return;
@@ -8488,7 +8497,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[list_ setEditing:NO];
[self updateButtonsForEditingStatus:NO animated:NO];
[list_ reloadData];
-}
+} }
- (void) showAddSourcePrompt {
UIAlertView *alert = [[[UIAlertView alloc]