-
Notifications
You must be signed in to change notification settings - Fork 3
Fix Android crash by enabling C++ exception handling in CMake configuration #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
yorkie
left a comment
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.
On Android, cxx bridge exceptions aren't handled the same way as regular C++ exceptions
You should make sure the cmake configuration supports C++ exception instead of not throwing the exception.
…ead of Rust workaround Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
You're absolutely right. I've fixed the CMake configuration to properly support C++ exceptions on Android instead of working around the issue in Rust code. Changes made in commit 9f27870:
This allows the existing try-catch block in |
|
9f27870 Validate on the device |
Problem
The app was crashing on Android when users entered non-URL text (like plain text or relative paths) due to an uncaught
rust::cxxbridge1::Error: relative URL without a baseexception. The crash occurred because C++ exception handling was disabled in the Android CMake configuration, preventing the existing try-catch block incontent.cpp:382from properly catching Rust exceptions.Root Cause
The issue was in the Android CMake configuration in
cmake/TransmuteCommon.cmake:-Wl,--no-eh-frame-hdrlinker flag disabled exception frame header generationcrates::parseURL()threw an exception for invalid URLs, it couldn't be caughtSIGABRTinstead of gracefully handling the errorSolution
Fixed the CMake configuration to properly enable C++ exception handling on Android:
Benefits
The fix ensures that when users enter invalid URLs, the existing error handling in
content.cppproperly catches the Rust exception and logs an appropriate error message instead of crashing the application.Fixes #155.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.