-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[google_sign_in] Fix crash on iOS caused by null hostedDomain #2521
Conversation
Thanks for the contribution! |
Hi @Hixie , My PR address two causes for a crash on iOS, although there may be more potential causes that all seem to be going under the one umbrella. The first change I made prevented the GoogleSignIn native code from crashing by ensuring The second change was to delete this line: [e raise]; This will immediately crash the app and serves no useful purpose (any uncaught exception on the Objective C side will crash the whole app). The line immediately prior to this actually sends a I don't think any specific new tests are required or possible for this one line change. As for all the other potential causes of an iOS crash, I don't know if this will help, but it may be a good idea to wrap the entire In any case, I will leave that for someone else to do because I wrote the original PR 4 months ago on a rented MacInCloud instance and it is not convenient for me to do so. |
Perhaps some can help explain why Note: I have heard that the |
@Hixie can you check why the submit-queue CI check failed? It doesn't appear to be anything caused by my change:
Maybe this was caused by the previous PR before mine:
As for my PR, I have added the |
Hi @ryanheise. Do you plan to work on adding tests for this PR? :) #2599 has set up some unit tests for the plugin, maybe you can follow that pattern? |
Hi @cyanglaz thanks for pointing to that. I was trying to learn how to do this from https://flutter.dev/docs/cookbook/testing but what you describe as unit testing sounds like it would only be possible in flutter with integration testing so that it can run on device. Maybe that is what e2e helps with, but is there a guide for this or another PR you can point me to that only adds a single test? I'm also not sure how to test for the presence or absence of the |
For the purpose of this PR, although it is great, it might not be necessary to test if |
FWIW, if the bug was that the code crashed when doing X, the usual test is one that does X and verifies that the code doesn't crash. :-) |
FlutterResult result = _accountRequest; | ||
_accountRequest = nil; | ||
result(error != nil ? getFlutterError(error) : account); | ||
dispatch_async(dispatch_get_main_queue(), ^{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you added this? It doesn't look like the docs say this comes back on a different thread. Did you see this happening in production?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was more a stab in the dark at addressing someone else's crash (which I couldn't reproduce myself): flutter/flutter#44564 (comment) , and I had intended to revert it after learning that it didn't fix his problem.
I've since moved off my macincloud subscription where I created this PR, so when I get a chance I'll need to set this up in my new dev environment.
Adding to the backlog; this is something we should add tests for as time allows so that it can be landed (modulo the question about the redispatch to main). |
@stuartmorgan I'll take it. It could be some holiday chill hack for me :) |
21a1a8c
to
56663bd
Compare
The same issue was fixed in #3805. I'm going to close this. |
Description
Fixes
google_sign_in
crash on iOS when callingsignIn()
whenhostedDomain
is null.Related Issues
Fixes flutter/flutter#44564
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?