Mercurial > hg > tony
comparison src/main.cpp @ 70:5310637392f6
Revert to using three separate tool modes (more like SV). This is less like the proposed design for Tony but better than the previous situation with two incomprehensible toggle buttons.
author | Chris Cannam |
---|---|
date | Tue, 26 Nov 2013 16:59:31 +0000 |
parents | ab10f175b4cb |
children | b405349d323f |
comparison
equal
deleted
inserted
replaced
69:045360070b66 | 70:5310637392f6 |
---|---|
19 #include "system/Init.h" | 19 #include "system/Init.h" |
20 #include "base/TempDirectory.h" | 20 #include "base/TempDirectory.h" |
21 #include "base/PropertyContainer.h" | 21 #include "base/PropertyContainer.h" |
22 #include "base/Preferences.h" | 22 #include "base/Preferences.h" |
23 #include "widgets/TipDialog.h" | 23 #include "widgets/TipDialog.h" |
24 #include "transform/TransformFactory.h" | |
24 | 25 |
25 #include <QMetaType> | 26 #include <QMetaType> |
26 #include <QApplication> | 27 #include <QApplication> |
27 #include <QDesktopWidget> | 28 #include <QDesktopWidget> |
28 #include <QMessageBox> | 29 #include <QMessageBox> |
37 | 38 |
38 #include <iostream> | 39 #include <iostream> |
39 #include <signal.h> | 40 #include <signal.h> |
40 | 41 |
41 static QMutex cleanupMutex; | 42 static QMutex cleanupMutex; |
43 static bool cleanedUp = false; | |
42 | 44 |
43 static void | 45 static void |
44 signalHandler(int /* signal */) | 46 signalHandler(int /* signal */) |
45 { | 47 { |
46 // Avoid this happening more than once across threads | 48 // Avoid this happening more than once across threads |
47 | 49 |
50 cerr << "signalHandler: cleaning up and exiting" << endl; | |
48 cleanupMutex.lock(); | 51 cleanupMutex.lock(); |
49 std::cerr << "signalHandler: cleaning up and exiting" << std::endl; | 52 if (!cleanedUp) { |
50 TempDirectory::getInstance()->cleanup(); | 53 TempDirectory::getInstance()->cleanup(); |
51 exit(0); // without releasing mutex | 54 cleanedUp = true; |
55 } | |
56 cleanupMutex.unlock(); | |
57 exit(0); | |
52 } | 58 } |
53 | 59 |
54 class TonyApplication : public QApplication | 60 class TonyApplication : public QApplication |
55 { | 61 { |
56 public: | 62 public: |
239 int rv = application.exec(); | 245 int rv = application.exec(); |
240 | 246 |
241 gui->hide(); | 247 gui->hide(); |
242 | 248 |
243 cleanupMutex.lock(); | 249 cleanupMutex.lock(); |
244 TempDirectory::getInstance()->cleanup(); | 250 |
251 if (!cleanedUp) { | |
252 TransformFactory::deleteInstance(); | |
253 TempDirectory::getInstance()->cleanup(); | |
254 cleanedUp = true; | |
255 } | |
256 | |
245 application.releaseMainWindow(); | 257 application.releaseMainWindow(); |
246 | 258 |
247 delete gui; | 259 delete gui; |
260 | |
261 cleanupMutex.unlock(); | |
248 | 262 |
249 return rv; | 263 return rv; |
250 } | 264 } |
251 | 265 |
252 /** Application-global handler for filepaths passed in, e.g. as | 266 /** Application-global handler for filepaths passed in, e.g. as |