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 e4fc26e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 8 deletions.
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;
}

10 changes: 7 additions & 3 deletions backend/libosmscout.cpp17.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
diff --git a/libosmscout/include/osmscout/feature/ChargingStationFeature.h b/libosmscout/include/osmscout/feature/ChargingStationFeature.h
index be79544e6..7e376ed2c 100644
index be79544e6..48c2cb10d 100644
--- a/libosmscout/include/osmscout/feature/ChargingStationFeature.h
+++ b/libosmscout/include/osmscout/feature/ChargingStationFeature.h
@@ -51,7 +51,7 @@ namespace osmscout {
@@ -51,7 +51,11 @@ namespace osmscout {
uint8_t capacity;
std::string output;

- std::strong_ordering operator<=>(const Socket& other) const = default;
+ bool operator==(const Socket& other) const = default;
+ bool operator==(const Socket& other) const {
+ return this->type == other.type &&
+ this->capacity == other.capacity &&
+ this->output == other.output;
+ }
};

private:

0 comments on commit e4fc26e

Please sign in to comment.