Brion VIBBER has submitted this change and it was merged.

Change subject: Fix for potential key-value observer crash bug.
......................................................................


Fix for potential key-value observer crash bug.

Change-Id: I91e36f02cd03dcf86b1b37aae0b8f475183ea2a5
---
M Commons-iOS/MyUploadsViewController.m
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Brion VIBBER: Verified; Looks good to me, approved



diff --git a/Commons-iOS/MyUploadsViewController.m 
b/Commons-iOS/MyUploadsViewController.m
index 9889eb6..3177e57 100644
--- a/Commons-iOS/MyUploadsViewController.m
+++ b/Commons-iOS/MyUploadsViewController.m
@@ -169,9 +169,6 @@
     [self.refreshControl addTarget:self action:@selector(refreshButtonPushed:)
                   forControlEvents:UIControlEventValueChanged];
     [self.collectionView addSubview:self.refreshControl];
- 
-    // Keep track of upload button state so it can be hidden from the My 
Uploads page whenever disabled
-    [self.uploadButton addObserver:self forKeyPath:@"enabled" 
options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | 
NSKeyValueObservingOptionPrior context:NULL];
     
     [self setupSettingsButton];
     [self setupAboutButton];
@@ -182,7 +179,10 @@
 - (void)viewWillAppear:(BOOL)animated {
     
     [super viewWillAppear:animated];
-  
+ 
+    // Keep track of upload button state so it can be hidden from the My 
Uploads page whenever disabled
+    [self.uploadButton addObserver:self forKeyPath:@"enabled" 
options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | 
NSKeyValueObservingOptionPrior context:NULL];
+ 
     // When the debug mode is toggled the fetchedResultsController.delegate 
was getting blasted for some reason
     // This resets it
     [CommonsApp singleton].fetchedResultsController.delegate = self;
@@ -220,6 +220,8 @@
     
     // Prevent the overlay message from flickering as the view disappears
     [self.welcomeOverlayView showMessage:WELCOME_MESSAGE_NONE];
+    
+    [self.uploadButton removeObserver:self forKeyPath:@"enabled"];
 }
 
 #pragma mark - Round buttons

-- 
To view, visit https://gerrit.wikimedia.org/r/90219
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I91e36f02cd03dcf86b1b37aae0b8f475183ea2a5
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/commons
Gerrit-Branch: master
Gerrit-Owner: Mhurd <mh...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to