1
0
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:
Tux3 / Mlkj / !Lev.uXFMLA 2015-02-06 19:38:08 +01:00
parent 331baa7447
commit 2e7c73dcb0
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
5 changed files with 21 additions and 3 deletions

View File

@ -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;
}

View File

@ -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()

View File

@ -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

View File

@ -42,6 +42,11 @@ SystemTrayIcon::SystemTrayIcon()
}
}
SystemTrayIcon::~SystemTrayIcon()
{
qDebug() << "Deleting SystemTrayIcon";
}
QString SystemTrayIcon::extractIconToFile(QIcon icon, QString name)
{
QString iconPath;

View File

@ -12,6 +12,7 @@ class SystemTrayIcon : public QObject
Q_OBJECT
public:
SystemTrayIcon();
~SystemTrayIcon();
void setContextMenu(QMenu* menu);
void show();
void hide();