[ios] Disconnect the manual password fill mediator if abruptly deleted

There are crashes that occur because the mediator is deleted before being
disconnected.

I am not exactly sure how this can happen but it is apparently possible.

Attempting to disconnect again on -dealloc mitigates that

Bug: 40063966
Change-Id: I1b75500e5a5b98ff1d60f18e33a35d149e980dd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5354446
Reviewed-by: Tommy Martino <tmartino@chromium.org>
Commit-Queue: Vincent Boisselle <vincb@google.com>
Cr-Commit-Position: refs/heads/main@{#1269964}
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_mediator.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_mediator.mm
index 72a00af..5d6b136a 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_mediator.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_mediator.mm
@@ -135,6 +135,10 @@
   return self;
 }
 
+- (void)dealloc {
+  [self disconnect];
+}
+
 - (void)disconnect {
   if (_webState) {
     [self webStateDestroyed:_webState];
@@ -438,7 +442,9 @@
 - (void)webStateDestroyed:(web::WebState*)webState {
   DCHECK_EQ(_webState, webState);
   if (_webState) {
-    _webState->RemoveObserver(_webStateObserverBridge.get());
+    if (_webStateObserverBridge) {
+      _webState->RemoveObserver(_webStateObserverBridge.get());
+    }
     _webState = nullptr;
   }
   _webStateObserverBridge.reset();