Verified Commit 70fa38fb authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

info: Pass parent to child QObjects

The info module is probably a memory leak right now
parent 6c156d87
Pipeline #35538 passed with stage
in 14 minutes and 22 seconds
......@@ -21,4 +21,7 @@
#include "distroinfo.h"
DistroInfo::DistroInfo() = default;
DistroInfo::DistroInfo(QObject *parent)
: QObject(parent)
{
}
......@@ -86,7 +86,7 @@ class DistroInfo : public QObject
PROPERTY(QString, logo)
public:
DistroInfo();
DistroInfo(QObject *parent = nullptr);
private:
KOSRelease m_osrelease;
......
......@@ -36,7 +36,10 @@
#include <sys/sysctl.h>
#endif
HardwareInfo::HardwareInfo() = default;
HardwareInfo::HardwareInfo(QObject *parent)
: QObject(parent)
{
}
int HardwareInfo::processorCount() const {
return Solid::Device::listFromType(Solid::DeviceInterface::Processor).count();
......
......@@ -37,7 +37,7 @@ class HardwareInfo : public QObject
QString memory() const;
public:
HardwareInfo();
HardwareInfo(QObject *parent = nullptr);
};
#endif // HARDWAREINFO_H
......@@ -31,9 +31,9 @@ K_PLUGIN_CLASS_WITH_JSON(Info, "info.json")
Info::Info(QObject *parent, const QVariantList &args)
: KQuickAddons::ConfigModule(parent, args),
m_distroInfo(new DistroInfo),
m_softwareInfo(new SoftwareInfo),
m_hardwareInfo(new HardwareInfo)
m_distroInfo(new DistroInfo(this)),
m_softwareInfo(new SoftwareInfo(this)),
m_hardwareInfo(new HardwareInfo(this))
{
KAboutData* about = new KAboutData("kcm_mobile_info", i18n("Info"),
"1.0", QString(), KAboutLicense::LGPL);
......
......@@ -29,8 +29,10 @@
#include <KConfigGroup>
#include <KLocalizedString>
SoftwareInfo::SoftwareInfo()
= default;
SoftwareInfo::SoftwareInfo(QObject *parent)
: QObject(parent)
{
}
QString SoftwareInfo::kernelRelease() const
{
......
......@@ -43,7 +43,7 @@ class SoftwareInfo : public QObject
QString osType() const;
public:
SoftwareInfo();
SoftwareInfo(QObject *parent = nullptr);
};
#endif // SOFTWAREINFO_H
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