Finally solved the problem which caused the application to crash when
drawing the detected lines.