Skip to content

Commit

Permalink
Update hardware Handle (#8187)
Browse files Browse the repository at this point in the history
In certain compilers, the assignment operators defined as default
doesn't automatically make a call to the parent's method if it's
user-defined.

Make this behavior explicit to avoid this edge case.

BUGS=[371980551]
  • Loading branch information
z3moon authored Oct 10, 2024
1 parent 614dbb4 commit 014e6bc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions filament/backend/include/backend/Handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <utils/debug.h>

#include <type_traits> // FIXME: STL headers are not allowed in public headers
#include <utility>

#include <stdint.h>

Expand Down Expand Up @@ -106,8 +107,18 @@ struct Handle : public HandleBase {
Handle(Handle const& rhs) noexcept = default;
Handle(Handle&& rhs) noexcept = default;

Handle& operator=(Handle const& rhs) noexcept = default;
Handle& operator=(Handle&& rhs) noexcept = default;
// Explicitly redefine copy/move assignment operators rather than just using default here.
// Because it doesn't make a call to the parent's method automatically during the std::move
// function call(https://en.cppreference.com/w/cpp/algorithm/move) in certain compilers like
// NDK 25.1.8937393 and below (see b/371980551)
Handle& operator=(Handle const& rhs) noexcept {
HandleBase::operator=(rhs);
return *this;
}
Handle& operator=(Handle&& rhs) noexcept {
HandleBase::operator=(std::move(rhs));
return *this;
}

explicit Handle(HandleId id) noexcept : HandleBase(id) { }

Expand Down

0 comments on commit 014e6bc

Please sign in to comment.