mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Cleanup before returning from main
This commit is contained in:
parent
331baa7447
commit
2e7c73dcb0
|
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
|
|||
AutoUpdater::installLocalUpdate(); ///< NORETURN
|
||||
#endif
|
||||
|
||||
Nexus::getInstance().start();
|
||||
Nexus::getInstance().start();
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
// Inter-process communication
|
||||
|
@ -191,5 +191,7 @@ Nexus::getInstance().start();
|
|||
logFile = nullptr;
|
||||
#endif
|
||||
|
||||
Nexus::destroyInstance();
|
||||
|
||||
return errorcode;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <src/widget/widget.h>
|
||||
#endif
|
||||
|
||||
static Nexus* nexus{nullptr};
|
||||
|
||||
Nexus::Nexus(QObject *parent) :
|
||||
QObject(parent),
|
||||
core{nullptr},
|
||||
|
@ -113,8 +115,15 @@ void Nexus::start()
|
|||
|
||||
Nexus& Nexus::getInstance()
|
||||
{
|
||||
static Nexus nexus;
|
||||
return nexus;
|
||||
if (!nexus)
|
||||
nexus = new Nexus;
|
||||
return *nexus;
|
||||
}
|
||||
|
||||
void Nexus::destroyInstance()
|
||||
{
|
||||
delete nexus;
|
||||
nexus = nullptr;
|
||||
}
|
||||
|
||||
Core* Nexus::getCore()
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
void start(); ///< Will initialise the systems (GUI, Core, ...)
|
||||
|
||||
static Nexus& getInstance();
|
||||
static void destroyInstance();
|
||||
static Core* getCore(); ///< Will return 0 if not started
|
||||
static AndroidGUI* getAndroidGUI(); ///< Will return 0 if not started
|
||||
static Widget* getDesktopGUI(); ///< Will return 0 if not started
|
||||
|
|
|
@ -42,6 +42,11 @@ SystemTrayIcon::SystemTrayIcon()
|
|||
}
|
||||
}
|
||||
|
||||
SystemTrayIcon::~SystemTrayIcon()
|
||||
{
|
||||
qDebug() << "Deleting SystemTrayIcon";
|
||||
}
|
||||
|
||||
QString SystemTrayIcon::extractIconToFile(QIcon icon, QString name)
|
||||
{
|
||||
QString iconPath;
|
||||
|
|
|
@ -12,6 +12,7 @@ class SystemTrayIcon : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
SystemTrayIcon();
|
||||
~SystemTrayIcon();
|
||||
void setContextMenu(QMenu* menu);
|
||||
void show();
|
||||
void hide();
|
||||
|
|
Loading…
Reference in New Issue
Block a user