From 8bc1525df5e4791df29e8ebca5c70f8c3290959b Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Thu, 21 May 2020 00:28:23 +0200 Subject: [PATCH] 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 --- src/gui/systray.cpp | 5 ++--- src/gui/systray.h | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 17ac06c6a..bd508319b 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -19,10 +19,9 @@ #include "tray/UserModel.h" #include -#include #include -#include #include +#include #include #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()); diff --git a/src/gui/systray.h b/src/gui/systray.h index 21f70ef4a..8ec154d3d 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -16,12 +16,10 @@ #define SYSTRAY_H #include -#include #include "accountmanager.h" #include "tray/UserModel.h" -class QIcon; class QQmlApplicationEngine; namespace OCC { -- 2.30.2