Skip to content

Commit

Permalink
Merge pull request spesmilo#3546 from cb8/fix-qrscanner
Browse files Browse the repository at this point in the history
qrscanner: Fix segfault when using a specific camera device
  • Loading branch information
ecdsa authored Dec 18, 2017
2 parents f231349 + 295d678 commit 1897797
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/qrscanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1897797

Please sign in to comment.