diff options
author | tg(x) <*@tg-x.net> | 2016-02-07 00:00:26 +0100 |
---|---|---|
committer | tg(x) <*@tg-x.net> | 2016-02-07 00:00:26 +0100 |
commit | 75f5018bcb7c7eb434cdfcdadb2b31bc557e2b40 (patch) | |
tree | c8bc115846dc7992646e5c38eb78b419ea4b6ad6 | |
parent | 11a0a496f7f3f78ca30f088adb7154235724f93c (diff) | |
download | secushare-75f5018bcb7c7eb434cdfcdadb2b31bc557e2b40.tar.gz secushare-75f5018bcb7c7eb434cdfcdadb2b31bc557e2b40.zip |
crash fix
-rw-r--r-- | src/app.cpp | 9 | ||||
-rw-r--r-- | src/app.h | 1 | ||||
-rw-r--r-- | src/main.cpp | 13 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/app.cpp b/src/app.cpp index e20de4a..b778cac 100644 --- a/src/app.cpp +++ b/src/app.cpp | |||
@@ -10,11 +10,11 @@ | |||
10 | #include <QtQml/qqml.h> | 10 | #include <QtQml/qqml.h> |
11 | 11 | ||
12 | 12 | ||
13 | /* static member variables */ | ||
14 | App *theApp; | 13 | App *theApp; |
15 | Settings *theSettings; | 14 | Settings *theSettings; |
16 | QQuickWindow *theWindow; | 15 | QQuickWindow *theWindow; |
17 | 16 | ||
17 | |||
18 | App::App (QObject * parent) | 18 | App::App (QObject * parent) |
19 | : QObject (parent) | 19 | : QObject (parent) |
20 | { | 20 | { |
@@ -33,12 +33,17 @@ App::App (QObject * parent) | |||
33 | 33 | ||
34 | App::~App () | 34 | App::~App () |
35 | { | 35 | { |
36 | delete m_qrProvider; | ||
37 | |||
38 | theApp = NULL; | ||
39 | theSettings = NULL; | ||
40 | theWindow = NULL; | ||
36 | } | 41 | } |
37 | 42 | ||
38 | 43 | ||
39 | /** | 44 | /** |
40 | * Connect to GNUnet services. | 45 | * Connect to GNUnet services. |
41 | * It needs to run in a separate thread. | 46 | * GNUnet operations take place in a separate thread. |
42 | */ | 47 | */ |
43 | void | 48 | void |
44 | App::startGnuNet () | 49 | App::startGnuNet () |
@@ -108,6 +108,7 @@ private: | |||
108 | void setTrayMessage (QString place, QString message); | 108 | void setTrayMessage (QString place, QString message); |
109 | }; | 109 | }; |
110 | 110 | ||
111 | |||
111 | // externals visible to the whole application (globals) | 112 | // externals visible to the whole application (globals) |
112 | 113 | ||
113 | extern App *theApp; | 114 | extern App *theApp; |
diff --git a/src/main.cpp b/src/main.cpp index 986d12b..6e0a415 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
@@ -16,12 +16,13 @@ main (int argc, char **argv) | |||
16 | QApplication qapp (argc, argv); | 16 | QApplication qapp (argc, argv); |
17 | 17 | ||
18 | // start our core application object | 18 | // start our core application object |
19 | App app; | 19 | App *app = new App (); |
20 | 20 | ||
21 | QQmlApplicationEngine engine (QUrl (QStringLiteral ("qrc:///qml/main.qml"))); | 21 | QQmlApplicationEngine * |
22 | engine = new QQmlApplicationEngine (QUrl (QStringLiteral ("qrc:///qml/main.qml"))); | ||
22 | 23 | ||
23 | // connect window to quit signal | 24 | // connect window to quit signal |
24 | QObject *topLevel = engine.rootObjects ().value (0); | 25 | QObject *topLevel = engine->rootObjects ().value (0); |
25 | theWindow = qobject_cast < QQuickWindow * >(topLevel); | 26 | theWindow = qobject_cast < QQuickWindow * >(topLevel); |
26 | if (!theWindow) | 27 | if (!theWindow) |
27 | { | 28 | { |
@@ -29,10 +30,10 @@ main (int argc, char **argv) | |||
29 | return -1; | 30 | return -1; |
30 | } | 31 | } |
31 | 32 | ||
32 | QObject::connect (&engine, SIGNAL (quit ()), | 33 | QObject::connect (engine, SIGNAL (quit ()), |
33 | &app, SLOT (close ())); | 34 | app, SLOT (close ())); |
34 | 35 | ||
35 | app.registerImageProvider (&engine); | 36 | app->registerImageProvider (engine); |
36 | 37 | ||
37 | theWindow->setTitle (QString ("secushare 0.1")); | 38 | theWindow->setTitle (QString ("secushare 0.1")); |
38 | theWindow->setIcon (QIcon (":/assets/icon.ico")); | 39 | theWindow->setIcon (QIcon (":/assets/icon.ico")); |