QFutureInterface(Base): code tidies
refT()/derefT() can be marked noexcept; we don't care about not overflowing the refcounter as a precondition. (This is BC, as no compiler mangles noexcept.) This in turn allows to mark a constructor calling refT() as noexcept. Driveby: mark also the same functions to not be `const` in Qt 7. They clearly are meant to modify *this, and constness only works because of the unmanaged (raw) d-pointer. Change-Id: I8d7d365640ff2e1cedc0a234c9abccdfc95ba6e3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
parent
49c5724cb8
commit
d598066dcf
@ -586,12 +586,12 @@ void QFutureInterfaceBase::swap(QFutureInterfaceBase &other) noexcept
|
|||||||
qSwap(d, other.d);
|
qSwap(d, other.d);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QFutureInterfaceBase::refT() const
|
bool QFutureInterfaceBase::refT() const noexcept
|
||||||
{
|
{
|
||||||
return d->refCount.refT();
|
return d->refCount.refT();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QFutureInterfaceBase::derefT() const
|
bool QFutureInterfaceBase::derefT() const noexcept
|
||||||
{
|
{
|
||||||
// Called from ~QFutureInterface
|
// Called from ~QFutureInterface
|
||||||
return !d || d->refCount.derefT();
|
return !d || d->refCount.derefT();
|
||||||
|
@ -178,8 +178,9 @@ public:
|
|||||||
void swap(QFutureInterfaceBase &other) noexcept;
|
void swap(QFutureInterfaceBase &other) noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool refT() const;
|
// ### Qt 7: remove const from refT/derefT
|
||||||
bool derefT() const;
|
bool refT() const noexcept;
|
||||||
|
bool derefT() const noexcept;
|
||||||
void reset();
|
void reset();
|
||||||
void rethrowPossibleException();
|
void rethrowPossibleException();
|
||||||
public:
|
public:
|
||||||
@ -234,7 +235,7 @@ public:
|
|||||||
refT();
|
refT();
|
||||||
}
|
}
|
||||||
QFutureInterface(const QFutureInterfaceBase &dd) : QFutureInterfaceBase(dd) { refT(); }
|
QFutureInterface(const QFutureInterfaceBase &dd) : QFutureInterfaceBase(dd) { refT(); }
|
||||||
QFutureInterface(QFutureInterfaceBase &&dd) : QFutureInterfaceBase(std::move(dd)) { refT(); }
|
QFutureInterface(QFutureInterfaceBase &&dd) noexcept : QFutureInterfaceBase(std::move(dd)) { refT(); }
|
||||||
QFutureInterface &operator=(const QFutureInterface &other)
|
QFutureInterface &operator=(const QFutureInterface &other)
|
||||||
{
|
{
|
||||||
QFutureInterface copy(other);
|
QFutureInterface copy(other);
|
||||||
|
Loading…
Reference in New Issue
Block a user