From 289c9966848a894305c15f0e6948db65ae0117b1 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 23 Dec 2016 14:26:02 +0100 Subject: [PATCH] Fix crash when deleting a contact with phone and sip address while editing --- Classes/ContactsListTableView.h | 1 + Classes/ContactsListTableView.m | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Classes/ContactsListTableView.h b/Classes/ContactsListTableView.h index af5e6ab1b..956b8b06e 100644 --- a/Classes/ContactsListTableView.h +++ b/Classes/ContactsListTableView.h @@ -28,6 +28,7 @@ @private OrderedDictionary *addressBookMap; } +@property(nonatomic) BOOL ongoing; - (void)loadData; - (void)loadSearchedData; - (void)removeAllContacts; diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index a9fc89ef5..b4d121f5c 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -36,7 +36,9 @@ } - (void)onAddressBookUpdate:(NSNotification *)k { - [self loadData]; + if (!_ongoing && (PhoneMainView.instance.currentView == ContactsListView.compositeViewDescription)) { + [self loadData]; + } } - (void)viewWillAppear:(BOOL)animated { @@ -54,6 +56,7 @@ if (self) { [self initContactsTableViewController]; } + _ongoing = FALSE; return self; } @@ -119,6 +122,7 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { } - (void)loadData { + _ongoing = TRUE; LOGI(@"Load contact list"); @synchronized(addressBookMap) { //Set all contacts from ContactCell to nil @@ -192,6 +196,7 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { } }); } + _ongoing = FALSE; } - (void)loadSearchedData {