2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Don't use shared_ptr for Dcenters.

This commit is contained in:
John Preston
2019-11-15 10:28:33 +03:00
parent f37ab6e38e
commit 055b99f5b0
9 changed files with 123 additions and 110 deletions

View File

@@ -249,7 +249,6 @@ ConnectionPrivate::ConnectionPrivate(
connect(thread, &QThread::started, this, [=] { connectToServer(); });
connect(thread, &QThread::finished, this, [=] { finishAndDestroy(); });
connect(this, SIGNAL(finished(internal::Connection*)), _instance, SLOT(connectionFinished(internal::Connection*)), Qt::QueuedConnection);
connect(_sessionData->owner(), SIGNAL(authKeyCreated()), this, SLOT(updateAuthKey()), Qt::QueuedConnection);
connect(_sessionData->owner(), SIGNAL(needToRestart()), this, SLOT(restartNow()), Qt::QueuedConnection);
@@ -1227,7 +1226,11 @@ void ConnectionPrivate::doDisconnect() {
void ConnectionPrivate::finishAndDestroy() {
doDisconnect();
_finished = true;
emit finished(_owner);
const auto connection = _owner;
const auto instance = _instance;
InvokeQueued(instance, [=] {
instance->connectionFinished(connection);
});
deleteLater();
}
@@ -1249,7 +1252,7 @@ void ConnectionPrivate::handleReceived() {
onReceivedSome();
auto restartOnError = [this, &lockFinished] {
const auto restartOnError = [&] {
lockFinished.unlock();
restart();
};