ftylitak/qzxing

Process Thread does not terminate correctly on destruction of QZXingFilterRunnable

Firomaeor opened this issue · 3 comments

Hi,
i am currently working on a cross platform project, that opens a dialog box from where I can scan a QR Code.
When I close the dialog box without waiting for the decoding to be finished, sometimes this can lead to segmentation fault.
At the moment, the dialog gets closed the Runnable will be destroyed, but the processThread will not be shut down properly.

I solved this issue by adding the processThread.cancel() statement from ~QZXingFilter to ~QZXingFilterRunnable as well.

i don't know if this is by any means helpful, but I wanted to share my experience.

Thanks a lot for your work.

@Firomaeor
your comment is interesting. As a procedure it looks a bit weird to cancel the thread in 2 places. I will look it up further some time next month and send an update here.

Yes, I agree. I guess it would be sufficient to do this in the destructor of the runnable.

@Firomaeor after reviewing your suggestion, indeed it looks as the correct way to go. The thread is now canceled in the destructor of QZXingFilterRunnable.