From 295d678e09dd26226657cf868eea4b7eaef748ea Mon Sep 17 00:00:00 2001 From: Charles Bell Date: Sun, 17 Dec 2017 20:45:03 +0100 Subject: [PATCH 1/2] Fix segfault when using a specific camera device --- lib/qrscanner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/qrscanner.py b/lib/qrscanner.py index f659d5e46c11..7516d55d5716 100644 --- a/lib/qrscanner.py +++ b/lib/qrscanner.py @@ -49,7 +49,8 @@ def scan_barcode(device='', timeout=-1, display=True, threaded=False): libzbar.zbar_symbol_set_first_symbol.restype = ctypes.POINTER(ctypes.c_int) proc = libzbar.zbar_processor_create(threaded) libzbar.zbar_processor_request_size(proc, 640, 480) - libzbar.zbar_processor_init(proc, device, display) + if libzbar.zbar_processor_init(proc, device.encode('utf-8'), display) != 0: + raise RuntimeError("Can not start QR scanner; initialization failed.") libzbar.zbar_processor_set_visible(proc) if libzbar.zbar_process_one(proc, timeout): symbols = libzbar.zbar_processor_get_results(proc) From f231349673285e7a70465dc1726c4243f9a35d98 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 17 Dec 2017 21:11:25 +0100 Subject: [PATCH 2/2] fix: crash when closing qrscanner window (see #3546) --- gui/qt/qrtextedit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gui/qt/qrtextedit.py b/gui/qt/qrtextedit.py index 42d999c00d4d..9e7e3ba6cdf6 100644 --- a/gui/qt/qrtextedit.py +++ b/gui/qt/qrtextedit.py @@ -56,6 +56,8 @@ def qr_input(self): except BaseException as e: self.show_error(str(e)) data = '' + if not data: + data = '' self.setText(data) return data