Skip to content

Commit

Permalink
workaround crash using android ndk>22
Browse files Browse the repository at this point in the history
The crash occurs in exception handling at osmscout::FileScanner::Close() line 267:
>> throw IOException(filename,"Cannot close file","File already closed");

So workaround calling FileScanner::CloseFailsafe(), which is noexcept
  • Loading branch information
janbar committed Oct 17, 2024
1 parent 9576ac1 commit 80bf7dc
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_android_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
- name: Setup Android SDK tools
uses: android-actions/setup-android@v3
with:
packages: "platform-tools platforms;android-31 build-tools;31.0.0 ndk;22.1.7171670"
packages: "platform-tools platforms;android-31 build-tools;31.0.0 ndk;26.3.11579264"
- name: Dump Android NDK
run: "ls ${ANDROID_HOME}/ndk"

- name: Configure ENV
run: |
echo "ANDROID_NDK=${ANDROID_HOME}/ndk/22.1.7171670" >> $GITHUB_ENV
echo "ANDROID_NDK=${ANDROID_HOME}/ndk/26.3.11579264" >> $GITHUB_ENV
echo "QT_DIR=${HOME}/Qt/5.15.15/android" >> $GITHUB_ENV
- name: Cache Qt
Expand Down
2 changes: 1 addition & 1 deletion android/linux-build-arm64-qt515.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mkdir -p $BUILD_DIR

export JAVA_HOME=$HOME/bin/java/jdk-17.0.12
export ANDROID_SDK_ROOT=$HOME/bin/android/sdk
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/22.1.7171670
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/26.3.11579264
export QT_DIR=$HOME/bin/Qt/5.15.15/android

cmake .. -B $BUILD_DIR -DCMAKE_SYSTEM_NAME=Android \
Expand Down
2 changes: 1 addition & 1 deletion android/linux-build-armv7-qt515.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mkdir -p $BUILD_DIR

export JAVA_HOME=$HOME/bin/java/jdk-17.0.12
export ANDROID_SDK_ROOT=$HOME/bin/android/sdk
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/22.1.7171670
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/26.3.11579264
export QT_DIR=$HOME/bin/Qt/5.15.15/android

cmake .. -B $BUILD_DIR -DCMAKE_SYSTEM_NAME=Android \
Expand Down
2 changes: 1 addition & 1 deletion android/linux-build-x64-qt515.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mkdir -p $BUILD_DIR

export JAVA_HOME=$HOME/bin/java/jdk-17.0.12
export ANDROID_SDK_ROOT=$HOME/bin/android/sdk
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/22.1.7171670
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/26.3.11579264
export QT_DIR=$HOME/bin/Qt/5.15.15/android

cmake .. -B $BUILD_DIR -DCMAKE_SYSTEM_NAME=Android \
Expand Down
2 changes: 1 addition & 1 deletion android/linux-build-x86-qt515.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mkdir -p $BUILD_DIR

export JAVA_HOME=$HOME/bin/java/jdk-17.0.12
export ANDROID_SDK_ROOT=$HOME/bin/android/sdk
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/22.1.7171670
export ANDROID_NDK=$HOME/bin/android/sdk/ndk/26.3.11579264
export QT_DIR=$HOME/bin/Qt/5.15.15/android

cmake .. -B $BUILD_DIR -DCMAKE_SYSTEM_NAME=Android \
Expand Down
2 changes: 1 addition & 1 deletion backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ set(libosmscout_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libosmscout")

# First apply our patches in the source of lib
list(APPEND libosmscout_patches
libosmscout.cpp17.patch
libosmscout.2.patch
)
foreach(patch IN LISTS libosmscout_patches)
execute_process(
Expand Down
18 changes: 18 additions & 0 deletions backend/libosmscout.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/libosmscout/src/osmscout/db/LocationIndex.cpp b/libosmscout/src/osmscout/db/LocationIndex.cpp
index 991eead42..d34241f43 100644
--- a/libosmscout/src/osmscout/db/LocationIndex.cpp
+++ b/libosmscout/src/osmscout/db/LocationIndex.cpp
@@ -133,12 +133,7 @@ namespace osmscout {

void LocationIndex::FileScannerPool::Destroy(FileScanner* o) noexcept
{
- try{
- o->Close();
- } catch (const IOException& e) {
- log.Error() << e.GetDescription();
- o->CloseFailsafe();
- }
+ o->CloseFailsafe();
delete o;
}

13 changes: 0 additions & 13 deletions backend/libosmscout.cpp17.patch

This file was deleted.

0 comments on commit 80bf7dc

Please sign in to comment.