Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion picamera2/picamera2.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ def __init__(self, camera_num=0, verbose_console=None, tuning=None, allocator=No
f'No camera number {camera_num} found - use "rpicam-hello --list-cameras" to check connected cameras'
)
camera_num = self.global_camera_info()[camera_num]['Num']
self._cm.add(camera_num, self)
self.camera_idx = camera_num
self.request_lock = threading.Lock() # global lock used by requests
self._requestslock = threading.Lock()
Expand All @@ -373,6 +372,8 @@ def __init__(self, camera_num=0, verbose_console=None, tuning=None, allocator=No
finally:
if tuning_file is not None:
tuning_file.close() # delete the temporary file
# All is good, now safe to register with the CameraManager.
self._cm.add(camera_num, self)
# Quitting Python without stopping the camera sometimes causes crashes, with Boost logging
# apparently being the principal culprit. Anyway, this seems to prevent the problem.
atexit.register(self.close)
Expand Down
Loading