fix for cleanup of SettingsManager thread

This commit is contained in:
Stephen Birarda 2015-03-30 18:00:15 -07:00
parent b8ff253f86
commit b7174b5170
2 changed files with 12 additions and 4 deletions

View file

@ -1,6 +1,6 @@
//
// SettingInterface.cpp
//
// libraries/shared/src
//
// Created by Clement on 2/2/15.
// Copyright 2015 High Fidelity, Inc.
@ -9,7 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <QCoreApplication>
#include <QDebug>
#include <QThread>
@ -23,8 +22,16 @@ namespace Setting {
// cleans up the settings private instance. Should only be run once at closing down.
void cleanupPrivateInstance() {
delete privateInstance;
privateInstance = nullptr;
// grab the thread before we nuke the instance
QThread* settingsManagerThread = privateInstance->thread();
// tell the private instance to clean itself up on its thread
privateInstance->deleteLater();
privateInstance = NULL;
// quit the settings manager thread and wait on it to make sure it's gone
settingsManagerThread->quit();
settingsManagerThread->wait();
}
// Sets up the settings private instance. Should only be run once at startup

View file

@ -16,6 +16,7 @@
namespace Setting {
Manager::~Manager() {
// Cleanup timer
stopTimer();
disconnect(_saveTimer, 0, 0, 0);