From 1feea03ec32fe7290989769ae04ba7930b5762a9 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Sun, 2 Dec 2018 13:32:38 +0100 Subject: [PATCH] Dispose the video player on error --- client/src/main/java/ctbrec/ui/PreviewPopupHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/src/main/java/ctbrec/ui/PreviewPopupHandler.java b/client/src/main/java/ctbrec/ui/PreviewPopupHandler.java index 2305a73a..e6ffc72a 100644 --- a/client/src/main/java/ctbrec/ui/PreviewPopupHandler.java +++ b/client/src/main/java/ctbrec/ui/PreviewPopupHandler.java @@ -242,6 +242,7 @@ public class PreviewPopupHandler implements EventHandler { if(videoPlayer.getError().getCause() != null) { LOG.error("Error while starting preview stream root cause:", videoPlayer.getError().getCause()); } + videoPlayer.dispose(); Platform.runLater(() -> { showTestImage(); }); @@ -277,6 +278,9 @@ public class PreviewPopupHandler implements EventHandler { } private void hidePopup() { + if(future != null && !future.isDone()) { + future.cancel(true); + } Platform.runLater(() -> { popup.setX(-1000); popup.setY(-1000);