Commit 6b490765 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Port DistanceInformationRegistrar into move semantics

We shouldn't rely on non-guaranteed behavior of the compiler
about RVO optimization. Let's just use move-semantics instead.
parent 81d8404b
......@@ -160,10 +160,18 @@ DistanceInformationRegistrar(KisPaintInformation *_p, KisDistanceInformation *di
p->d->registerDistanceInfo(distanceInfo);
}
KisPaintInformation::DistanceInformationRegistrar::DistanceInformationRegistrar(KisPaintInformation::DistanceInformationRegistrar &&rhs)
: p(0)
{
std::swap(p, rhs.p);
}
KisPaintInformation::DistanceInformationRegistrar::
~DistanceInformationRegistrar()
{
p->d->unregisterDistanceInfo();
if (p) {
p->d->unregisterDistanceInfo();
}
}
KisPaintInformation::KisPaintInformation(const QPointF & pos,
......
......@@ -71,6 +71,8 @@ public:
{
public:
DistanceInformationRegistrar(KisPaintInformation *_p, KisDistanceInformation *distanceInfo);
DistanceInformationRegistrar(const DistanceInformationRegistrar &rhs) = delete;
DistanceInformationRegistrar(DistanceInformationRegistrar &&rhs);
~DistanceInformationRegistrar();
private:
KisPaintInformation *p;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment