-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Shutting down thread pool of the CustomGeometrySource when the source is destroyed #12517
Conversation
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.
When the Android app is sent to the background, is there a notification that can be used to also pause, cancel requests or possible delete these threads ?
|
||
static auto releaseThreads = javaClass.GetMethod<void ()>(*_env, "releaseThreads"); | ||
|
||
assert(javaPeer); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
Moved to #12551
0453ce2
to
5d3cd21
Compare
Another round for you @asheemmamoowala with 5d3cd21. I'm releasing the threads when the source is removed. Is the current check for Also, 5d3cd21 seems to crash for me when running What's next to be done is releasing/stopping threads with Android lifecycle. |
331b77d
to
b143957
Compare
800ab9b
to
157faaf
Compare
Trying to shutdown the executor before we release the peer in 157faaf but with that setup I'm hitting
which looks like the |
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.
The source is removed on the main thread, but it still exists on the Render thread until the frame is complete and the next style diff is processed there.
custom_geometry_source.cpp:66: void mbgl::android::CustomGeometrySource::fetchTile(const mbgl::CanonicalTileID &): assertion "javaPeer" failed
It's possible this crash existed even before your changes. Can you run the test without any changes and see if you still hit this assert?
@@ -28,8 +28,11 @@ class CustomGeometrySource : public Source { | |||
|
|||
~CustomGeometrySource(); | |||
|
|||
bool removeFromMap(JNIEnv&, jni::Object<Source>, mbgl::Map&); |
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.
nit: Add override
declaration
|
||
void Source::releaseJavaPeer() { |
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 you are separating this method from removeFromMap
, it would be good to add back the checks for valid ownedSource
so that it doesn't crash in the apps if called incorrectly.
c0cd5d7
to
8e99fdf
Compare
You are right, the assertion fails on Other comments have been addressed. |
8e99fdf
to
abbb13c
Compare
…the source is destroyed
abbb13c
to
41f3c33
Compare
41f3c33 recreates the executor when the previously removed source is re-added. |
Fixes #12516.