kded: parent the Kded object to the application instance

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-22 05:40:13 +03:00
parent d9281db1f8
commit f0451272ec
2 changed files with 7 additions and 10 deletions

View file

@ -100,8 +100,9 @@ static void runDontChangeHostname(const QByteArray &oldName, const QByteArray &n
QProcess::execute("kdontchangethehostname", args);
}
Kded::Kded()
: m_pDirWatch(nullptr),
Kded::Kded(QObject *parent)
: QObject(parent),
m_pDirWatch(nullptr),
m_pTimer(nullptr),
m_recreateBusy(false),
m_serviceWatcher(nullptr),
@ -686,8 +687,8 @@ int main(int argc, char *argv[])
checkStamps = cg.readEntry("CheckFileStamps", true);
delayedCheck = cg.readEntry("DelayedCheck", false);
Kded *kded = new Kded();
kded->recreate(true); // Build initial database
Kded kded(&app);
kded.recreate(true); // Build initial database
#ifdef Q_WS_X11
XEvent e;
@ -704,11 +705,7 @@ int main(int argc, char *argv[])
(void) new KHostnameD(HostnamePollInterval); // Watch for hostname changes
}
int result = app.exec(); // keep running
delete kded;
return result;
return app.exec(); // keep running
}
#include "moc_kded.cpp"

View file

@ -42,7 +42,7 @@ class Kded : public QObject
{
Q_OBJECT
public:
Kded();
Kded(QObject *parent);
virtual ~Kded();
static Kded *self() { return _self;}