Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit dcb4a6cf authored by Alexander Volkov's avatar Alexander Volkov

Don't leak Edid

It is created and owned by Output, so QScopedPointer must be used
instead of not owning QPointer.
parent 56932fc2
......@@ -25,7 +25,7 @@
#include "debug_p.h"
#include <QStringList>
#include <QPointer>
#include <QScopedPointer>
#include <QRect>
using namespace KScreen;
......@@ -67,7 +67,7 @@ class Q_DECL_HIDDEN Output::Private
modeList.insert(otherMode->id(), otherMode->clone());
}
if (other.edid) {
edid = other.edid->clone();
edid.reset(other.edid->clone());
}
}
......@@ -93,7 +93,7 @@ class Q_DECL_HIDDEN Output::Private
bool primary;
bool followPreferredMode = false;
mutable QPointer<Edid> edid;
mutable QScopedPointer<Edid> edid;
};
bool Output::Private::compareModeList(const ModeList& before, const ModeList &after)
......@@ -463,12 +463,12 @@ void Output::setClones(QList<int> outputlist)
void Output::setEdid(const QByteArray& rawData)
{
Q_ASSERT(d->edid.isNull());
d->edid = new Edid(rawData);
d->edid.reset(new Edid(rawData));
}
Edid *Output::edid() const
{
return d->edid;
return d->edid.data();
}
QSize Output::sizeMm() const
......@@ -579,8 +579,7 @@ void Output::apply(const OutputPtr& other)
// Non-notifyable changes
if (other->d->edid) {
delete d->edid;
d->edid = other->d->edid->clone();
d->edid.reset(other->d->edid->clone());
}
blockSignals(keepBlocked);
......
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