-
Notifications
You must be signed in to change notification settings - Fork 110
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
Android app crashes with null pointer dereference exception #182
Comments
I confirm that i have sigsegv on my testing too |
I confirm facing the same problem. But it happens with randomness when we switch back and forth. |
Yup, it seems like it's related to the maplibre native library and i suspect the problem to be related to the C++ part of the JNI. Take a look here: maplibre/maplibre-native#177 |
I experience the same. There is a workaround mentioned on flutter-mapbox-gl. flutter-mapbox-gl/maps#1119 (comment) Would something similar work for maplibre-gl? Thank you |
I face the same problem, also with randomness. |
Yes I am facing the same problem. It happens when I switch pages "fast" (map is only displayed in one of my page). |
I took the file from the fix from mapBox (this one), and add it at this path : flutter-maplibre-gl-c723434d635068157311eb47c26df3e0554ff894\maplibre_gl_platform_interface\lib\src It seems to fix the issue ! At least I have not mannage to make it happen again. I'll do a PR :) |
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.
I have open a pull request with the fix I copied from mapbox. It seems to work for me, let me know if it does for you ! |
I tried the PR from @GaelleJoubert on Flutter 3.7, with and without the KeepAlive trick. Unfortunately without success. It reduces the occurrence of the bug, but it still crashes. I'm used a bottom navigation with the Maplibre widget in one tab, by quickly switching between these tabs the app crashes after 2-3 jumps. Has anyone already tried the PR from flutter mapbox gl flutter-mapbox-gl/maps#1273 ? This is actually a show stopper for us, so we downgraded to Flutter 2.10.5 (but would be good to use Flutter 3). |
I have the same architecture than you : bottom navigation with the Maplibre widget in one tab. And I have noticed the same behavior : It reduces the occurrence of the bug, but it still crashes. |
@JanikoNaber I try to apply the fix from flutter-mapbox-gl/maps#1273, but it does not pass all the check now .. |
i'll check tomorrow and i'll test too to be sure that fixes the crash. This is clearly a breaking bug that needs to be fixed. Thanks @GaelleJoubert for all the work |
Hi, thank you for your efforts @GaelleJoubert and @mariusvn 👐 Any conclusion yet? |
I did not have time to work on it this week, i'll try to do it next week |
Fix issue #182 --------- Co-authored-by: m0nac0 <58807793+m0nac0@users.noreply.github.com>
Is this fixed for you guys with the changes from #203? |
Yes I think so |
Hey thanks a lot for updating. Unfortunately, I still get the null pointer dereference exception. But maybe I am doing something else wrong: F/libc (10367): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 10733 (Thread-9) |
It's weird, that error was completely gone the last weeks. |
I have a doubt that fluuter actually use an "old" reference of "main", when I add the dependency like that :
And that's why I have the crash back (I've just switch back to main tooday).
And I don't have the crash any more. Can you try that, and tell me if you still have the crash ? |
That's weird, maybe a |
Yeah maybe, I am super buisy right know, so I'll just stay with the method that works for me. |
Hi all, I still see the same exception. I can reproduce it by switching between the map and other tabs quickly. Thanks for your efforts though. (really appreciated) However, I fix this, by switching to to an IndexedStack, which will make the map view persistent. With the IndexedStack I do not see this error anymore. Best |
This PR should fix the crash as described in #182 and #257 The status is still in draft because I would like to get feedback from android devs of maplibre-gl-native. ### Problem The crash started to occure with flutter 3.x and after some investigations we were able to detect the exact change that broke it. See flutter/flutter#107297 or flutter/flutter#107297 (comment) for details. The engine change in flutter/engine@8dc7cd1 is not calling `removeView` in all cases which might be the reason why this issue is happening. I digged into the framework and saw that `removeView` will trigger `onDetachedFromWindow` in the subviews. This is important since once of the subviews is `TextureView` which destorys the surface texture: Here is `TextureView.onDeatachedFromWindowInternal` ```java @OverRide @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) protected void onDetachedFromWindowInternal() { destroyHardwareLayer(); releaseSurfaceTexture(); super.onDetachedFromWindowInternal(); } ``` My guess: If this is not called we might still draw onto a surface which triggers the crash. ### The fix If my assumptions are correct then this should be fixed in the engine and not in the libraries that need a platform view. You can find the workaround in this PR. We simply create a view container that calls `removeView` to trigger the `onDetachedFromWindow`. We tested this in an example app with success and also in some of our internal projects. Please give some feedback if my assumptions are correct. Thanks! --------- Co-authored-by: Julian Bissekkou <julian.bissekkou@tapped.dev> Co-authored-by: Stefan Schaller <stefan.schaller@tapped.dev>
Fix issue maplibre#182 --------- Co-authored-by: m0nac0 <58807793+m0nac0@users.noreply.github.com>
This PR should fix the crash as described in maplibre#182 and maplibre#257 The status is still in draft because I would like to get feedback from android devs of maplibre-gl-native. ### Problem The crash started to occure with flutter 3.x and after some investigations we were able to detect the exact change that broke it. See flutter/flutter#107297 or flutter/flutter#107297 (comment) for details. The engine change in flutter/engine@8dc7cd1 is not calling `removeView` in all cases which might be the reason why this issue is happening. I digged into the framework and saw that `removeView` will trigger `onDetachedFromWindow` in the subviews. This is important since once of the subviews is `TextureView` which destorys the surface texture: Here is `TextureView.onDeatachedFromWindowInternal` ```java @OverRide @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) protected void onDetachedFromWindowInternal() { destroyHardwareLayer(); releaseSurfaceTexture(); super.onDetachedFromWindowInternal(); } ``` My guess: If this is not called we might still draw onto a surface which triggers the crash. ### The fix If my assumptions are correct then this should be fixed in the engine and not in the libraries that need a platform view. You can find the workaround in this PR. We simply create a view container that calls `removeView` to trigger the `onDetachedFromWindow`. We tested this in an example app with success and also in some of our internal projects. Please give some feedback if my assumptions are correct. Thanks! --------- Co-authored-by: Julian Bissekkou <julian.bissekkou@tapped.dev> Co-authored-by: Stefan Schaller <stefan.schaller@tapped.dev>
This makes the package unusable. Hope this gets fixed soon. |
This issue should in fact already be resolved. Are you seeing the exact same issue? If so, please share with which flutter version, plugin version, Android version you are experiencing this. |
pls |
@dawid-niedzwiecki Are you seeing the exact same issue? If so, please share with which flutter version, plugin version, Android version you are experiencing this. |
I think this is fixed, if not, please open a new issue with a detailed reproduction. |
This problem may be related to flutter/flutter#107297
Steps to reproduce:
The text was updated successfully, but these errors were encountered: