diff options
Diffstat (limited to 'src/cam')
-rw-r--r-- | src/cam/kms_sink.cpp | 7 | ||||
-rw-r--r-- | src/cam/kms_sink.h | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp index 37a3bd50..16435ede 100644 --- a/src/cam/kms_sink.cpp +++ b/src/cam/kms_sink.cpp @@ -301,7 +301,8 @@ bool KMSSink::processRequest(libcamera::Request *camRequest) DRM::FrameBuffer *drmBuffer = iter->second.get(); unsigned int flags = DRM::AtomicRequest::FlagAsync; - DRM::AtomicRequest *drmRequest = new DRM::AtomicRequest(&dev_); + std::unique_ptr<DRM::AtomicRequest> drmRequest = + std::make_unique<DRM::AtomicRequest>(&dev_); drmRequest->addProperty(plane_, "FB_ID", drmBuffer->id()); if (!active_ && !queued_) { @@ -324,12 +325,12 @@ bool KMSSink::processRequest(libcamera::Request *camRequest) flags |= DRM::AtomicRequest::FlagAllowModeset; } - pending_ = std::make_unique<Request>(drmRequest, camRequest); + pending_ = std::make_unique<Request>(std::move(drmRequest), camRequest); std::lock_guard<std::mutex> lock(lock_); if (!queued_) { - int ret = drmRequest->commit(flags); + int ret = pending_->drmRequest_->commit(flags); if (ret < 0) { std::cerr << "Failed to commit atomic request: " diff --git a/src/cam/kms_sink.h b/src/cam/kms_sink.h index 4a0a872c..8f5f0866 100644 --- a/src/cam/kms_sink.h +++ b/src/cam/kms_sink.h @@ -38,8 +38,9 @@ private: class Request { public: - Request(DRM::AtomicRequest *drmRequest, libcamera::Request *camRequest) - : drmRequest_(drmRequest), camRequest_(camRequest) + Request(std::unique_ptr<DRM::AtomicRequest> drmRequest, + libcamera::Request *camRequest) + : drmRequest_(std::move(drmRequest)), camRequest_(camRequest) { } |