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

[Android] [JNI] [Crash] Application crush when using ResourceTransformCallback #8580

Closed
amotzg opened this issue Mar 30, 2017 · 1 comment
Closed
Assignees
Labels
Android Mapbox Maps SDK for Android crash

Comments

@amotzg
Copy link

amotzg commented Mar 30, 2017

Platform: Android x86 emulator API level 23 (latest Studio/SDK version).
Mapbox SDK version: 5.0.1

Steps to trigger behavior

  1. Add to the map Activity OnCreate FileSource.getInstance(this).setResourceTransform(this);
  2. Make Activity implement FileSource.ResourceTransformCallback by simply returning one valid URL for any onUrl() call.

Expected behavior

All tiles use data retrived from the location returned by onUrl().

Actual behavior

Application crush while asking transition for the first tile.

Studio project and logcat attached.
Need to add access token to project as I've removed mine. Also, although this code never reached, the URL returned by onURL() is only meaningful on my setup.

170330__logcat_mb_resource_transform.txt
resource_transform_tester.tar.gz

Before testing on a clean application, I attempted resource transform on my project with integrated MapBox SDK source. Having the source, debugger stop on getting the callback from FileSource::ResourceTransformCallback::javaClass inside FileSource::ResourceTransformCallback::onURL.

screenshot_2017-03-30_12-34-59

@ivovandongen ivovandongen added Android Mapbox Maps SDK for Android crash labels Mar 30, 2017
@ivovandongen ivovandongen self-assigned this Mar 30, 2017
@ivovandongen
Copy link
Contributor

@amotzg Thanks for the report and the reproduction project. Very helpful!

There is a problem with the thread on which the callback is executed, this is solved in #8582. However, given your example, there is another issue. You use the activity as the callback, this will leak the activity once it goes out of scope. Be sure to use either a) a static inner class or b) to de-register the callback on Activity#onDestroy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android crash
Projects
None yet
Development

No branches or pull requests

2 participants