diff --git a/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java index 608468c7..921a1e12 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java @@ -31,6 +31,7 @@ import com.sparrowwallet.sparrow.io.Config; import com.sparrowwallet.sparrow.io.bbqr.BBQRDecoder; import com.sparrowwallet.sparrow.io.bbqr.BBQRException; import com.sparrowwallet.sparrow.wallet.KeystoreController; +import io.reactivex.Observable; import javafx.application.Platform; import javafx.beans.property.DoubleProperty; import javafx.beans.property.ObjectProperty; @@ -57,6 +58,7 @@ import java.nio.charset.CharsetDecoder; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.List; +import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -201,7 +203,8 @@ public class QRScanDialog extends Dialog { Platform.runLater(() -> { webcamResolutionProperty.set(null); - webcamService.close(); + Observable.just(this).delay(500, TimeUnit.MILLISECONDS) + .subscribe(_ -> webcamService.close(), throwable -> log.error("Error closing webcam", throwable)); }); });