mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
use Dependency customDeleter for Application NL
This commit is contained in:
parent
cd2ce2ee2f
commit
09e2c0987e
2 changed files with 10 additions and 3 deletions
|
@ -336,6 +336,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
|
||||
_datagramProcessor = new DatagramProcessor(nodeList.data());
|
||||
|
||||
// have the NodeList use deleteLater from DM customDeleter
|
||||
nodeList->setCustomDeleter([](Dependency* dependency) {
|
||||
static_cast<NodeList*>(dependency)->deleteLater();
|
||||
});
|
||||
|
||||
// put the NodeList and datagram processing on the node thread
|
||||
nodeList->moveToThread(nodeThread);
|
||||
|
||||
|
@ -609,9 +614,8 @@ Application::~Application() {
|
|||
//DependencyManager::destroy<ScriptCache>();
|
||||
DependencyManager::destroy<SoundCache>();
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
QThread* nodeThread = nodeList->thread();
|
||||
nodeList->deleteLater();
|
||||
QThread* nodeThread = DependencyManager::get<NodeList>()->thread();
|
||||
DependencyManager::destroy<NodeList>();
|
||||
|
||||
// ask the node thread to quit and wait until it is done
|
||||
nodeThread->quit();
|
||||
|
|
|
@ -37,6 +37,7 @@ const quint64 DOMAIN_SERVER_CHECK_IN_MSECS = 1 * 1000;
|
|||
|
||||
const int MAX_SILENT_DOMAIN_SERVER_CHECK_INS = 5;
|
||||
|
||||
class Application;
|
||||
class Assignment;
|
||||
|
||||
class NodeList : public LimitedNodeList {
|
||||
|
@ -95,6 +96,8 @@ private:
|
|||
HifiSockAddr _assignmentServerSocket;
|
||||
bool _hasCompletedInitialSTUNFailure;
|
||||
unsigned int _stunRequestsSinceSuccess;
|
||||
|
||||
friend class Application;
|
||||
};
|
||||
|
||||
#endif // hifi_NodeList_h
|
||||
|
|
Loading…
Reference in a new issue