From: Stephan Beyer Date: Wed, 20 May 2020 22:28:23 +0000 (+0200) Subject: Fix leak in Systray X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~220^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8bc1525df5e4791df29e8ebca5c70f8c3290959b;p=nextcloud-desktop.git 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 --- 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 {