From c1366c7b4133e9720d562946ebbceb832706d97f Mon Sep 17 00:00:00 2001 From: jkds Date: Sun, 29 Jun 2025 21:47:27 +0200 Subject: [PATCH] android: make set_panic_hook configurable using a Platform conf setting. --- src/conf.rs | 5 +++++ src/native/android.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/conf.rs b/src/conf.rs index 09a4244a..a7a3d407 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -169,6 +169,10 @@ pub struct Platform { // for most purposes they are the same so we just use class name for simplicity // https://unix.stackexchange.com/questions/494169/ pub linux_wm_class: &'static str, + + /// Whether to automatically setup the panic hook for Android. + /// Set this to false if your app does its own panic_hook setup to avoid conflicts. + pub android_panic_hook: bool, } impl Default for Platform { @@ -183,6 +187,7 @@ impl Default for Platform { framebuffer_alpha: false, wayland_decorations: WaylandDecorations::default(), linux_wm_class: "miniquad-application", + android_panic_hook: true, } } } diff --git a/src/native/android.rs b/src/native/android.rs index 3b583e3e..a52d59c3 100644 --- a/src/native/android.rs +++ b/src/native/android.rs @@ -369,7 +369,7 @@ pub unsafe fn run(conf: crate::conf::Conf, f: F) where F: 'static + FnOnce() -> Box, { - { + if conf.platform.android_panic_hook { use std::ffi::CString; use std::panic;