From: Stephan Beyer Date: Mon, 18 May 2020 10:26:18 +0000 (+0200) Subject: Fix leak in OCC::AccountManager stub for FolderManTest X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~220^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f275640343c3fff5a1a07fa963773cf1306712cf;p=nextcloud-desktop.git Fix leak in OCC::AccountManager stub for FolderManTest We simply use a static QObject using Q_GLOBAL_STATIC() instead of allocating a leaking QObject on the heap. Signed-off-by: Stephan Beyer --- diff --git a/test/stubfolderman.cpp b/test/stubfolderman.cpp index 2a60ecb9a..0ee32d731 100644 --- a/test/stubfolderman.cpp +++ b/test/stubfolderman.cpp @@ -1,7 +1,9 @@ // stub to prevent linker error #include "accountmanager.h" -OCC::AccountManager *OCC::AccountManager::instance() { return static_cast(new QObject); } +Q_GLOBAL_STATIC(QObject, dummy) + +OCC::AccountManager *OCC::AccountManager::instance() { return static_cast(dummy()); } void OCC::AccountManager::save(bool) { } void OCC::AccountManager::saveAccountState(AccountState *) { } void OCC::AccountManager::deleteAccount(AccountState *) { }