Git commit d9d9e43c562ef13e40ed5d37f06f2f34d902e21f by Till Adam. Committed on 25/01/2013 at 18:11. Pushed by tilladam into branch 'KDE/4.10'. Cancel in-flight dbus queries to avoid leaks. If close() is called on the query service client while dbus queries are still in flight, they were left dangling. This change makes sure they are properly cancelled. Without this, all such dangling queries are maintained by nepomuk and updated constantly, causing extreme loads, over time. REVIEW: 108550 M +9 -2 libnepomukcore/query/queryserviceclient.cpp http://commits.kde.org/nepomuk-core/d9d9e43c562ef13e40ed5d37f06f2f34d902e21f diff --git a/libnepomukcore/query/queryserviceclient.cpp b/libnepomukcore/q= uery/queryserviceclient.cpp index 10ae928..ac3e1d0 100644 --- a/libnepomukcore/query/queryserviceclient.cpp +++ b/libnepomukcore/query/queryserviceclient.cpp @@ -404,8 +404,15 @@ QList< Nepomuk2::Query::Result > Nepomuk2::Query::Quer= yServiceClient::syncDeskto void Nepomuk2::Query::QueryServiceClient::close() { // drop pending query calls - // TODO: This could lead to dangling queries in the service when close= is called before the pending call has returned!!! - // We could also use a stack of pending calls or something like = that. + + // in case we fired a query but it did not return yet, cancel it + if (d->m_pendingCallWatcher && !d->queryInterface) { + QDBusPendingReply reply =3D *(d->m_pendingCallWat= cher); + OrgKdeNepomukQueryInterface interface( d->queryServiceInterface->s= ervice(), + reply.value().path(), + d->dbusConnection ); + interface.close(); + } delete d->m_pendingCallWatcher; = d->m_errorMessage.truncate(0);