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

View file

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