Ensure file provider class is correctly deallocated and cleanup routines are run

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2022-11-30 17:11:52 +01:00
parent 2d27d6d072
commit 8ff2c24e8b
No known key found for this signature in database
GPG key ID: C839200C384636B0
4 changed files with 18 additions and 7 deletions

View file

@ -51,6 +51,8 @@
#if defined(Q_OS_WIN)
#include <windows.h>
#elif defined(Q_OS_MACOS)
#include "macOS/fileprovider.h"
#endif
#if defined(WITH_CRASHREPORTER)
@ -371,8 +373,10 @@ Application::Application(int &argc, char **argv)
}
_folderManager.reset(new FolderMan);
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
_shellExtensionsServer.reset(new ShellExtensionsServer);
#elif defined(Q_OS_MACOS)
_fileProvider.reset(Mac::FileProvider::instance());
#endif
connect(this, &SharedTools::QtSingleApplication::messageReceived, this, &Application::slotParseMessage);

View file

@ -49,6 +49,12 @@ class Folder;
class ShellExtensionsServer;
class SslErrorDialog;
#ifdef Q_OS_MACOS
namespace Mac {
class FileProvider;
}
#endif
/**
* @brief The Application class
* @ingroup gui
@ -152,8 +158,10 @@ private:
QScopedPointer<CrashReporter::Handler> _crashHandler;
#endif
QScopedPointer<FolderMan> _folderManager;
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
QScopedPointer<ShellExtensionsServer> _shellExtensionsServer;
#elif defined(Q_OS_MACOS)
QScopedPointer<Mac::FileProvider> _fileProvider;
#endif
};

View file

@ -0,0 +1,4 @@
#ifndef FILEPROVIDERINTERFACE_H
#define FILEPROVIDERINTERFACE_H
#endif // FILEPROVIDERINTERFACE_H

View file

@ -22,10 +22,6 @@
#include <sys/resource.h>
#endif
#ifdef Q_OS_MACOS
#include "macOS/fileprovider.h"
#endif
#include "application.h"
#include "cocoainitializer.h"
#include "theme.h"
@ -78,7 +74,6 @@ int main(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
#ifdef Q_OS_MAC
Mac::CocoaInitializer cocoaInit; // RIIA
const auto fileProvider = OCC::Mac::FileProvider::instance();
#endif
auto surfaceFormat = QSurfaceFormat::defaultFormat();