Commit 6c93d253 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Don't create a QPointer for a QObject in destruction

This hits an assert in Qt and potentially crashes.
parent d9f3ff04
......@@ -87,7 +87,16 @@ void NotificationManager::registerConnection(quintptr socketDescriptor)
qCDebug(AKONADISERVER_LOG) << "New notification connection (registered as" << subscriber << ")";
connect(subscriber, &QObject::destroyed,
this, [this, subscriber]() {
// Can't use mSubscribers.remove() because that would try to create
// a QPointer for the subscriber pointer triggering a Q_ASSERT in Qt
// (see QtSharedPointer::ExternalRefCountData::getAndRef)
auto it = std::find_if(mSubscribers.begin(), mSubscribers.end(),
[subscriber](const QPointer<NotificationSubscriber> &qptr) {
return == subscriber;
if (it != mSubscribers.end()) {
connect(subscriber, &NotificationSubscriber::notificationDebuggingChanged,
this, [this](bool enabled) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment