-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
Hmm the major problem is the GL implementation should never crash. It is supposed to check for bad state and return a GL error instead. |
After some debugging, it looks like the following is happening:
Here's my proposed change: Instead of directly deleting all OpenGL objects, we should accumulate the IDs and delete them during the next render step. |
Why does the stack trace have ~LiveTileData in the back trace. Is there some code path that triggers invalidateTiles outside mapThread? |
~LiveTileData is run in the map thread |
Cross-ref to #1022 — I will double-check that things are kosher here. |
0dfd9fa
to
5830a57
Compare
On iOS, the main thread does framebuffer operations just before it requests a rerender of the view contents. This means that GL operations on the Map thread will interfere with that and cause a crash. While most GL operations happen throughout rendering (which is synchronized with the main thread), deletion of shared_ptrs release in turn their OpenGL objects. This may happen at any time and isn't synced with rendering. This patch changes this so instead of deleting all objects immediately, we are collecting all abandoned IDs and delete them in bulk once the main thread has given us permission to use OpenGL calls (i.e. during render()).
5830a57
to
61fa436
Compare
…tion Crash when deleting buffers
+1 Awesome, no more crashing. Thanks! |
@@ -113,7 +127,6 @@ void Map::start(bool startPaused) { | |||
|
|||
// Remove all of these to make sure they are destructed in the correct thread. | |||
style.reset(); | |||
workers.reset(); |
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.
This crashes in Debug mode since the Worker threads are now joined from the wrong thread.
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.
Fixed in 9d30d40
I'm seeing a fairly frequent crash bug that happens randomly during buffer deletion. The buffer IDs are valid and do exist.
What could be happening is that we have an OpenGL context loss that we're ignoring, which invalidates all of the buffers.