From a4b50d2a7834cf8a89eb908b634ad1c97a93d9b0 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Wed, 9 Feb 2022 16:48:02 -0600 Subject: [PATCH] Set PREFS_CRASH_KEY synchronously Sometimes the app dies before this preference gets written to disk, and then the crash dialog is not displayed to the user Signed-off-by: Alex Baker --- changelog.d/5195.bugfix | 1 + .../app/features/rageshake/VectorUncaughtExceptionHandler.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/5195.bugfix diff --git a/changelog.d/5195.bugfix b/changelog.d/5195.bugfix new file mode 100644 index 00000000000..50d47e089eb --- /dev/null +++ b/changelog.d/5195.bugfix @@ -0,0 +1 @@ +Reliably display crash report prompt diff --git a/vector/src/main/java/im/vector/app/features/rageshake/VectorUncaughtExceptionHandler.kt b/vector/src/main/java/im/vector/app/features/rageshake/VectorUncaughtExceptionHandler.kt index 670b28f1e14..bd2f0b67bdc 100644 --- a/vector/src/main/java/im/vector/app/features/rageshake/VectorUncaughtExceptionHandler.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/VectorUncaughtExceptionHandler.kt @@ -63,7 +63,7 @@ class VectorUncaughtExceptionHandler @Inject constructor( */ override fun uncaughtException(thread: Thread, throwable: Throwable) { Timber.v("Uncaught exception: $throwable") - preferences.edit { + preferences.edit(commit = true) { putBoolean(PREFS_CRASH_KEY, true) } val b = StringBuilder()