Make sure renderThread is alive before calling requestExitAndWait() (#3461)

This commit is contained in:
Bart Louwers
2025-05-13 20:37:39 +02:00
committed by GitHub
parent 307470439a
commit bb071bb2e9
3 changed files with 14 additions and 6 deletions

View File

@@ -1,6 +1,14 @@
# Changelog MapLibre Native for Android
## main
## 11.8.8
### ✨ Features and improvements
- Update NDK to 28.1.13356709 ([#3450](https://github.com/maplibre/maplibre-native/pull/3450)).
### 🐞 Bug fixes
- Make sure renderThread is alive before calling requestExitAndWait() ([#3461](https://github.com/maplibre/maplibre-native/pull/3461)).
## 11.8.7

View File

@@ -1,4 +1,4 @@
VERSION_NAME=11.8.7
VERSION_NAME=11.8.8
# Only build native dependencies for the current ABI
# See https://code.google.com/p/android/issues/detail?id=221098#c20

View File

@@ -51,7 +51,7 @@ public abstract class MapLibreSurfaceView extends SurfaceView implements Surface
@Override
protected void finalize() throws Throwable {
try {
if (renderThread != null) {
if (renderThread != null && renderThread.isAlive()) {
// thread may still be running if this view was never
// attached to a window.
renderThread.requestExitAndWait();
@@ -249,7 +249,7 @@ public abstract class MapLibreSurfaceView extends SurfaceView implements Surface
if (detachedListener != null) {
detachedListener.onSurfaceViewDetached();
}
if (renderThread != null) {
if (renderThread != null && renderThread.isAlive()) {
renderThread.requestExitAndWait();
}
detached = true;
@@ -435,9 +435,9 @@ public abstract class MapLibreSurfaceView extends SurfaceView implements Surface
synchronized (renderThreadManager) {
shouldExit = true;
renderThreadManager.notifyAll();
while (!exited) {
while (!exited && this.isAlive()) {
try {
renderThreadManager.wait();
renderThreadManager.wait(100);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}