-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash android dispose nullpointerdereference #203
Fix crash android dispose nullpointerdereference #203
Conversation
Fix issue maplibre#182 I took the file from the fix from mapBox (this one), and add it at the same place in maplibre. It seems to fix the issue ! At least I have not mannage to make it happen again.
Thank you for contributing this! If so, I think we should fully port both flutter-mapbox-gl/maps#1172 and flutter-mapbox-gl/maps#1217 which introduced/improved this fix over there (and contain a few other changes as well). |
Yes, as I mentionned in the issue #182 , I copied this file, from the MapBox library. I have not check the rest :) |
can you flutter format the code and try to fix the warnings ? |
edit to fix warnings
format
I try to format automatically the code, but it did not change the warning :/ |
I haven't looked at in detail, but I assume this is because we need to port all changes from flutter-mapbox-gl/maps#1172 and flutter-mapbox-gl/maps#1217. |
reproduced fix #1172 step 1
Copy Fix #1172 step2
README.md
Outdated
@@ -147,6 +147,11 @@ buildTypes { | |||
} | |||
``` | |||
|
|||
## Flutter 3.x.x issues | |||
Since Flutter 3.x.x was introduced, it exposed some race conditions resulting in occasional crashes upon map disposal. The parameter `useDelayedDisposal` was introduced as a workaround for this issue until Flutter and/or Mapbox fix this issue properly. Use with caution. |
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.
Since Flutter 3.x.x was introduced, it exposed some race conditions resulting in occasional crashes upon map disposal. The parameter `useDelayedDisposal` was introduced as a workaround for this issue until Flutter and/or Mapbox fix this issue properly. Use with caution. | |
Since Flutter 3.x.x was introduced, it exposed some race conditions resulting in occasional crashes upon map disposal. The parameter `useDelayedDisposal` was introduced as a workaround for this issue until Flutter and/or MapLibre fix this issue properly. Use with caution. |
I am porting all the changes at the moment :) |
Ok, I finnaly fixed all the warning, this is ready to merge. |
I have tried it on my maps. |
By the way, I found a nice workaround to avois the crash. Exemple of code :
Should I add that to the Readme, in Fix frequent errors ? |
with |
If I understand correctly, no It is not, it is the same that was created the first time. I also use other MapLibre instance in some pop up or preview in other pages, but these one did not cause crash, and I did not wrap them in KeppAlives. I think I have the crash at dispose because each time I switch page the page view rebuild and sipose all pages, and do that too fast, and that cause the crash. |
Hey, You have found a solution. |
@mariusvn Hi, did you have any time to check (and update?) the CI that build the apk ? |
1 similar comment
@mariusvn Hi, did you have any time to check (and update?) the CI that build the apk ? |
we need to update the dependencies (old versions are in the pubspec.lock) by executing |
Thanks for the tips ! I'll do it by tomorrow :) |
i was talking of a flutter upgrade not, updating the pubspec.yaml. You should rollback your last changes because the dependencies upgrade in pubspec.yaml should be done in a separate PR. |
ok ok, I'll revert the changes. |
yep should be |
hmm it looks like it didn't pass but it works on my side after the |
Ok, I just ran " Here is the result of it in my console, if it helps :
|
Can you |
Try to change flutter ci according to exemple given by subosito
example/pubspec.lock
Outdated
source: hosted | ||
version: "1.2.1" | ||
file: | ||
dependency: transitive | ||
description: | ||
name: file | ||
url: "https://pub.dartlang.org" | ||
sha256: b69516f2c26a5bcac4eee2e32512e1a5205ab312b3536c1c1227b2b942b5f9ad | ||
url: "https://pub.dev" | ||
source: hosted | ||
version: "6.1.2" |
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.
I think we may need to upgrade the file plugin version of the example app. But we shouldn‘t do this manually here in the pubspec.lock file. Have you tried running flutter pub upgrade in the example directory (not the project root) and committed/pushed the changes to example/pubspec.lock?
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.
Youhou ! Looks like it was that !!
I ran pub upgrade in the exemple directory (and not the project root), and it worked !! :D
Finnally !!
The CI uses flutter 3.7.7, is that what you are using? I think the issue is that version 6.1.2 of the file plugin is used in the example app, but there was a breaking change of sorts in version 6.1.3 https://pub.dev/packages/file/changelog |
@m0nac0 ready to be merged, finnaly ! |
Fix issue maplibre#182 --------- Co-authored-by: m0nac0 <58807793+m0nac0@users.noreply.github.com>
Fix issue #182