diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index f0eaa68f0..c23a6fb9d 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -184,9 +184,6 @@ struct impl { 0, nullptr, 0, this ); - if (source.fd >= 0) - spa_system_close(system, std::exchange(source.fd, -1)); - camera->requestCompleted.disconnect(this, &impl::requestComplete); if (int res = camera->stop(); res < 0) { @@ -194,6 +191,9 @@ struct impl { camera->id().c_str(), spa_strerror(res)); } + if (source.fd >= 0) + spa_system_close(system, std::exchange(source.fd, -1)); + completed_requests_rb = SPA_RINGBUFFER_INIT(); active = false;