Backport an upstream commit I made which fixes some Solid-related crashes.
The crashes themselves only occur under some special circumstances, but since it may take some time to get an exp-run for a more recent KDE version and the newest KTorrent release does cause this crash, it makes sense to add this patch for now.
This commit is contained in:
parent
6fcb72ece2
commit
c8c82cf5bf
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=304454
@ -8,6 +8,7 @@
|
||||
|
||||
PORTNAME= kdelibs
|
||||
PORTVERSION= ${KDE4_VERSION}
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= x11 kde ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_KDE}
|
||||
MASTER_SITE_SUBDIR= ${KDE4_BRANCH}/${PORTVERSION}/src
|
||||
|
153
x11/kdelibs4/files/patch-git_e405fa9
Normal file
153
x11/kdelibs4/files/patch-git_e405fa9
Normal file
@ -0,0 +1,153 @@
|
||||
commit e405fa978b3c308249a5d553b784d3f8b277fd35
|
||||
Author: Raphael Kubo da Costa <rakuco@FreeBSD.org>
|
||||
Date: Wed Jul 18 22:32:41 2012 -0300
|
||||
|
||||
HAL: Use the filtering code in HalDevice in devicesFromQuery().
|
||||
|
||||
Follow what other backends such as the UDisks one do and simply relay
|
||||
the required checks for validity to each Device we are interested in.
|
||||
|
||||
So far, HalDevice::queryDeviceInterface() performed some checks
|
||||
depending on the DeviceInterface type being passed to it, while
|
||||
HalManager::devicesFromQuery() did not filter the results it got in
|
||||
the same way. What's more, some checks such as the video4linux ones
|
||||
were being made in both places, leading to some needless duplication
|
||||
in functionality.
|
||||
|
||||
As a side-effect, this fixes a bug made visibile by a recent commit to
|
||||
libktorrent: retrieving StorageAccess devices with listFromType()
|
||||
would simply query HAL for devices with the "volume" capability (which
|
||||
includes swap partitions and other non-mountable things), so using
|
||||
Device::asDeviceInterface(Solid::DeviceInterface::StorageAccess) would
|
||||
sometimes return 0 on a few of those entries retrieved earlier.
|
||||
|
||||
Reviewed-by: Alberto Villa <avilla@FreeBSD.org>
|
||||
REVIEW: 105615
|
||||
|
||||
diff --git a/solid/solid/backends/hal/halmanager.cpp b/solid/solid/backends/hal/halmanager.cpp
|
||||
index 2c9c6c0..7238b6a 100644
|
||||
--- solid/solid/backends/hal/halmanager.cpp
|
||||
+++ solid/solid/backends/hal/halmanager.cpp
|
||||
@@ -147,30 +147,27 @@ bool HalManager::deviceExists(const QString &udi)
|
||||
QStringList HalManager::devicesFromQuery(const QString &parentUdi,
|
||||
Solid::DeviceInterface::Type type)
|
||||
{
|
||||
- if (!parentUdi.isEmpty())
|
||||
- {
|
||||
- QStringList result = findDeviceStringMatch("info.parent", parentUdi);
|
||||
+ if ((parentUdi.isEmpty()) && (type == Solid::DeviceInterface::Unknown)) {
|
||||
+ return allDevices();
|
||||
+ }
|
||||
|
||||
- if (type!=Solid::DeviceInterface::Unknown) {
|
||||
- const QStringList matches = result;
|
||||
- result.clear();
|
||||
+ QStringList result;
|
||||
|
||||
- foreach (const QString &match, matches) {
|
||||
- HalDevice device(match);
|
||||
+ foreach (const QString &udi, allDevices()) {
|
||||
+ HalDevice device(udi);
|
||||
|
||||
- if (device.queryDeviceInterface(type)) {
|
||||
- result << match;
|
||||
- }
|
||||
- }
|
||||
+ if ((!parentUdi.isEmpty()) && (parentUdi != device.parentUdi())) {
|
||||
+ continue;
|
||||
}
|
||||
|
||||
- return result;
|
||||
+ if ((type != Solid::DeviceInterface::Unknown) && (!device.queryDeviceInterface(type))) {
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- } else if (type!=Solid::DeviceInterface::Unknown) {
|
||||
- return findDeviceByDeviceInterface(type);
|
||||
- } else {
|
||||
- return allDevices();
|
||||
+ result << udi;
|
||||
}
|
||||
+
|
||||
+ return result;
|
||||
}
|
||||
|
||||
QObject *HalManager::createDevice(const QString &udi)
|
||||
@@ -182,63 +179,6 @@ QObject *HalManager::createDevice(const QString &udi)
|
||||
}
|
||||
}
|
||||
|
||||
-QStringList HalManager::findDeviceStringMatch(const QString &key, const QString &value)
|
||||
-{
|
||||
- QDBusReply<QStringList> reply = d->manager.call("FindDeviceStringMatch", key, value);
|
||||
-
|
||||
- if (!reply.isValid())
|
||||
- {
|
||||
- qWarning() << Q_FUNC_INFO << " error: " << reply.error().name() << endl;
|
||||
- return QStringList();
|
||||
- }
|
||||
-
|
||||
- return reply;
|
||||
-}
|
||||
-
|
||||
-QStringList HalManager::findDeviceByDeviceInterface(Solid::DeviceInterface::Type type)
|
||||
-{
|
||||
- QStringList cap_list = DeviceInterface::toStringList(type);
|
||||
- QStringList result;
|
||||
-
|
||||
- foreach (const QString &cap, cap_list)
|
||||
- {
|
||||
- QDBusReply<QStringList> reply = d->manager.call("FindDeviceByCapability", cap);
|
||||
-
|
||||
- if (!reply.isValid())
|
||||
- {
|
||||
- qWarning() << Q_FUNC_INFO << " error: " << reply.error().name() << endl;
|
||||
- return QStringList();
|
||||
- }
|
||||
- if ( cap == QLatin1String( "video4linux" ) )
|
||||
- {
|
||||
- QStringList foundDevices ( reply );
|
||||
- QStringList filtered;
|
||||
- foreach ( const QString &udi, foundDevices )
|
||||
- {
|
||||
- QDBusInterface device( "org.freedesktop.Hal", udi, "org.freedesktop.Hal.Device", QDBusConnection::systemBus() );
|
||||
- QDBusReply<QString> reply = device.call( "GetProperty", "video4linux.device" );
|
||||
- if (!reply.isValid())
|
||||
- {
|
||||
- qWarning() << Q_FUNC_INFO << " error getting video4linux.device: " << reply.error().name() << endl;
|
||||
- continue;
|
||||
- }
|
||||
- if ( !reply.value().contains( "video" ) )
|
||||
- {
|
||||
- continue;
|
||||
- }
|
||||
- filtered.append( udi );
|
||||
- }
|
||||
- result += filtered;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- result << reply;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return result;
|
||||
-}
|
||||
-
|
||||
void HalManager::slotDeviceAdded(const QString &udi)
|
||||
{
|
||||
d->devicesCache.append(udi);
|
||||
diff --git a/solid/solid/backends/hal/halmanager.h b/solid/solid/backends/hal/halmanager.h
|
||||
index ec42fac..377b15d 100644
|
||||
--- solid/solid/backends/hal/halmanager.h
|
||||
+++ solid/solid/backends/hal/halmanager.h
|
||||
@@ -59,9 +59,6 @@ private Q_SLOTS:
|
||||
void slotDeviceRemoved(const QString &udi);
|
||||
|
||||
private:
|
||||
- QStringList findDeviceStringMatch(const QString &key, const QString &value);
|
||||
- QStringList findDeviceByDeviceInterface(Solid::DeviceInterface::Type type);
|
||||
-
|
||||
HalManagerPrivate *d;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user