From 43394f9ff3178a16d22424c3e8504578abd655c3 Mon Sep 17 00:00:00 2001 From: Hans-Peter Lehmann Date: Tue, 23 Jun 2026 07:56:44 +0200 Subject: [PATCH] Fix crash when speed dialog gets closed while handler is running (#8541) ### Description Fix crash when speed dialog gets closed while handler is running. This seems super hard to trigger, but apparently some of our beta testers managed to do it. ### Checklist - [x] I have read the contribution guidelines: https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md#submit-a-pull-request - [x] I have performed a self-review of my code, going through my changes line by line and carefully considering why this line change is necessary - [x] I have run the automated code checks using `./gradlew checkstyle lint` - [x] My code follows the style guidelines of the AntennaPod project: https://antennapod.org/contribute/develop/app/code-style - [x] I have mentioned the corresponding issue and the relevant keyword (e.g., "Closes: #xy") in the description (see https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) - [x] If it is a core feature, I have added automated tests --- .../ui/screen/playback/VariableSpeedDialog.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/VariableSpeedDialog.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/VariableSpeedDialog.java index 84643f750..d13d0f285 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/VariableSpeedDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/VariableSpeedDialog.java @@ -191,15 +191,13 @@ public class VariableSpeedDialog extends BottomSheetDialogFragment { }); holder.chip.setOnClickListener(v -> { UserPreferences.setPlaybackSpeed(speed); - new Handler(Looper.getMainLooper()).postDelayed(() -> { - if (BuildConfig.USE_MEDIA3_PLAYBACK_SERVICE) { - PlaybackController.bindToMedia3Service(getContext(), - controller -> controller.setPlaybackSpeed(speed)); - } else if (controller != null) { - controller.setPlaybackSpeed(speed); - } - dismiss(); - }, 200); + if (BuildConfig.USE_MEDIA3_PLAYBACK_SERVICE) { + PlaybackController.bindToMedia3Service(getContext(), + controller -> controller.setPlaybackSpeed(speed)); + } else if (controller != null) { + controller.setPlaybackSpeed(speed); + } + new Handler(Looper.getMainLooper()).postDelayed(() -> dismiss(), 200); }); }