Skip to content

Commit

Permalink
syncobj: ensure we only add waiters on succesful checks (#9412)
Browse files Browse the repository at this point in the history
timeline check only returns nullopt on ETIME_ERR , meaning the if check
later on returns true if drmSyncobjTimelineWait returns anything else
like EINVAL/EPERM/EACCESS etc, so actually check the returned .value()
of the std::optional. also move the fd to rvalue references.
  • Loading branch information
gulafaran authored Feb 15, 2025
1 parent 2f96703 commit 3eb6cb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/protocols/DRMSyncobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ CDRMSyncobjSurfaceResource::CDRMSyncobjSurfaceResource(SP<CWpLinuxDrmSyncobjSurf
return;
}

if (materialized)
if (materialized.value())
return;

surface->lockPendingState();
Expand Down Expand Up @@ -104,7 +104,7 @@ bool CDRMSyncobjSurfaceResource::good() {
return resource->resource();
}

CDRMSyncobjTimelineResource::CDRMSyncobjTimelineResource(SP<CWpLinuxDrmSyncobjTimelineV1> resource_, CFileDescriptor fd_) : fd(std::move(fd_)), resource(resource_) {
CDRMSyncobjTimelineResource::CDRMSyncobjTimelineResource(SP<CWpLinuxDrmSyncobjTimelineV1> resource_, CFileDescriptor&& fd_) : fd(std::move(fd_)), resource(resource_) {
if UNLIKELY (!good())
return;

Expand Down
2 changes: 1 addition & 1 deletion src/protocols/DRMSyncobj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CDRMSyncobjSurfaceResource {

class CDRMSyncobjTimelineResource {
public:
CDRMSyncobjTimelineResource(SP<CWpLinuxDrmSyncobjTimelineV1> resource_, Hyprutils::OS::CFileDescriptor fd_);
CDRMSyncobjTimelineResource(SP<CWpLinuxDrmSyncobjTimelineV1> resource_, Hyprutils::OS::CFileDescriptor&& fd_);
~CDRMSyncobjTimelineResource() = default;
static SP<CDRMSyncobjTimelineResource> fromResource(wl_resource*);

Expand Down

0 comments on commit 3eb6cb1

Please sign in to comment.