From 4716894027872486a1e63c56ed841f1eb4310aa1 Mon Sep 17 00:00:00 2001 From: fourtf Date: Tue, 3 Jan 2017 22:08:20 +0100 Subject: [PATCH] fixed it --- ircmanager.cpp | 7 ++++++- ircmanager.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ircmanager.cpp b/ircmanager.cpp index 0ee586235..3d30672d9 100644 --- a/ircmanager.cpp +++ b/ircmanager.cpp @@ -5,11 +5,14 @@ #include "QThreadPool" #include "QRunnable" #include "lambdaqrunnable.h" +#include "qcoreapplication.h" IrcConnection* IrcManager::connection = NULL; QMutex* IrcManager::connectionMutex = new QMutex(); long IrcManager::connectionIteration = 0; +QObject* IrcManager::parent = new QObject(); + IrcManager::IrcManager() { @@ -41,7 +44,7 @@ void IrcManager::beginConnecting() c->setUserName("justinfan123"); c->setNickName("justinfan123"); c->setRealName("justinfan123"); - c->sendRaw("JOIN #hsdogdog"); + c->sendRaw("JOIN #fourtf"); c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/commands")); c->sendCommand(IrcCommand::createCapability("REQ", "twitch.tv/tags")); @@ -50,6 +53,8 @@ void IrcManager::beginConnecting() connectionMutex->lock(); if (iteration == connectionIteration) { + delete connection; + c->moveToThread(QCoreApplication::instance()->thread()); connection = c; } else { diff --git a/ircmanager.h b/ircmanager.h index 0f8419287..f64baf339 100644 --- a/ircmanager.h +++ b/ircmanager.h @@ -17,6 +17,8 @@ private: static void beginConnecting(); + static QObject* parent; + static IrcConnection* connection; static QMutex* connectionMutex; static long connectionIteration;