Fix logout current connection crash
Make sure that the neochat can handle switching connection when the current one is logged out. This is mostly about using QPointer to handle use after free issues due to room objects being deleted.
This commit is contained in:
@@ -57,7 +57,7 @@ void NotificationsManager::processNotificationJob(QPointer<NeoChatConnection> co
|
||||
if (job == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (connection == nullptr) {
|
||||
if (connection == nullptr || !connection->isLoggedIn()) {
|
||||
qWarning() << QStringLiteral("No connection for GetNotificationsJob %1").arg(job->objectName());
|
||||
return;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ void NotificationsManager::processNotificationJob(QPointer<NeoChatConnection> co
|
||||
|
||||
bool NotificationsManager::shouldPostNotification(QPointer<NeoChatConnection> connection, const QJsonValue ¬ification)
|
||||
{
|
||||
if (connection == nullptr) {
|
||||
if (connection == nullptr || !connection->isLoggedIn()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user