Commit 0cbe2a0000ec9e9c2e0a23acbf94a6a0bfd9b6f2
1 parent
e1c7b86f
Fix main app scope in tests
It didn't clean up the old ones, causing unpredictable problems.
Showing
3 changed files
with
10 additions
and
4 deletions
FlashMQTests/mainappthread.cpp
| ... | ... | @@ -19,15 +19,19 @@ License along with FlashMQ. If not, see <https://www.gnu.org/licenses/>. |
| 19 | 19 | |
| 20 | 20 | MainAppThread::MainAppThread(QObject *parent) : QThread(parent) |
| 21 | 21 | { |
| 22 | + MainApp::initMainApp(1, nullptr); | |
| 23 | + appInstance = MainApp::getMainApp(); | |
| 24 | + appInstance->settings->allowAnonymous = true; | |
| 25 | +} | |
| 26 | + | |
| 27 | +MainAppThread::~MainAppThread() | |
| 28 | +{ | |
| 22 | 29 | if (appInstance) |
| 23 | 30 | { |
| 24 | 31 | delete appInstance; |
| 32 | + MainApp::instance = nullptr; | |
| 25 | 33 | } |
| 26 | 34 | appInstance = nullptr; |
| 27 | - MainApp::instance = nullptr; | |
| 28 | - MainApp::initMainApp(1, nullptr); | |
| 29 | - appInstance = MainApp::getMainApp(); | |
| 30 | - appInstance->settings->allowAnonymous = true; | |
| 31 | 35 | } |
| 32 | 36 | |
| 33 | 37 | void MainAppThread::run() | ... | ... |
FlashMQTests/mainappthread.h