Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Context leak #11126

Closed
tobrun opened this issue Feb 6, 2018 · 0 comments
Closed

Context leak #11126

tobrun opened this issue Feb 6, 2018 · 0 comments
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@tobrun
Copy link
Member

tobrun commented Feb 6, 2018

device-2018-02-06-143511

The code responsible for above in MapView.java:

    getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
      @Override
      public void onGlobalLayout() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
          getViewTreeObserver().removeOnGlobalLayoutListener(this);
        } else {
          getViewTreeObserver().removeGlobalOnLayoutListener(this);
        }
        initialiseDrawingSurface(options);
      }
    });

This issue with this is that if the hosting activity/viewhiearchy is destroyed before it's measured it will never remove the listener and thus leaking the view/context.

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Feb 6, 2018
@tobrun tobrun added this to the android-v5.4.1 milestone Feb 6, 2018
@tobrun tobrun self-assigned this Feb 6, 2018
@tobrun tobrun closed this as completed Feb 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

1 participant