Fix leak in Systray

The member _trayEngine, allocated in the constructor, was leaking.

This commit sets the Systray instance as the Qt object tree parent of
the _trayEngine to fix the leak.

While at it, a few unused header includes have been removed.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
This commit is contained in:
Stephan Beyer 2020-05-21 00:28:23 +02:00
parent eaf4aa0e5b
commit 8bc1525df5
2 changed files with 2 additions and 5 deletions

View file

@ -19,10 +19,9 @@
#include "tray/UserModel.h" #include "tray/UserModel.h"
#include <QCursor> #include <QCursor>
#include <QDesktopServices>
#include <QGuiApplication> #include <QGuiApplication>
#include <QQmlComponent>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QScreen> #include <QScreen>
#ifdef USE_FDO_NOTIFICATIONS #ifdef USE_FDO_NOTIFICATIONS
@ -50,8 +49,8 @@ Systray *Systray::instance()
Systray::Systray() Systray::Systray()
: _isOpen(false) : _isOpen(false)
, _syncIsPaused(false) , _syncIsPaused(false)
, _trayEngine(new QQmlApplicationEngine(this))
{ {
_trayEngine = new QQmlApplicationEngine;
_trayEngine->addImportPath("qrc:/qml/theme"); _trayEngine->addImportPath("qrc:/qml/theme");
_trayEngine->addImageProvider("avatars", new ImageProvider); _trayEngine->addImageProvider("avatars", new ImageProvider);
_trayEngine->rootContext()->setContextProperty("userModelBackend", UserModel::instance()); _trayEngine->rootContext()->setContextProperty("userModelBackend", UserModel::instance());

View file

@ -16,12 +16,10 @@
#define SYSTRAY_H #define SYSTRAY_H
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QQmlContext>
#include "accountmanager.h" #include "accountmanager.h"
#include "tray/UserModel.h" #include "tray/UserModel.h"
class QIcon;
class QQmlApplicationEngine; class QQmlApplicationEngine;
namespace OCC { namespace OCC {