[packages/dleyna-connector-dbus] Initial release
megabajt
megabajt at pld-linux.org
Thu Dec 10 21:28:02 CET 2015
commit f0401976ffb12487c9885a719b73726b80997066
Author: Marcin Banasiak <marcin.banasiak at gmail.com>
Date: Thu Dec 10 21:27:38 2015 +0100
Initial release
...on-t-crash-when-trying-to-unwatch-non-exi.patch | 87 ++++++++++++++++++++++
dleyna-connector-dbus.spec | 67 +++++++++++++++++
2 files changed, 154 insertions(+)
---
diff --git a/dleyna-connector-dbus.spec b/dleyna-connector-dbus.spec
new file mode 100644
index 0000000..0161574
--- /dev/null
+++ b/dleyna-connector-dbus.spec
@@ -0,0 +1,67 @@
+Summary: D-Bus connector for dLeyna services
+Name: dleyna-connector-dbus
+Version: 0.2.0
+Release: 1
+License: LGPL v2
+Group: Applications
+Source0: https://01.org/sites/default/files/downloads/dleyna/%{name}-%{version}.tar.gz
+# Source0-md5: 04c2425239d092f4da457c061be7aa81
+Patch0: 0001-Connector-Don-t-crash-when-trying-to-unwatch-non-exi.patch
+URL: https://01.org/dleyna/
+BuildRequires: autoconf >= 2.66
+BuildRequires: automake
+BuildRequires: dbus-devel
+BuildRequires: dleyna-core-devel >= 0.2.1
+BuildRequires: glib2-devel >= 1:2.28.0
+BuildRequires: libtool >= 2:2.2.6
+BuildRequires: pkgconfig >= 1:0.16
+Requires: dbus
+Requires: dleyna-core >= 0.2.1
+Requires: glib2 >= 1:2.28.0
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+D-Bus connector for dLeyna services.
+
+%package devel
+Summary: Development files for dleyna-connector-dbus
+Group: Development/Libraries
+Requires: dbus-devel
+Requires: glib2-devel >= 1:2.28.0
+
+%description devel
+This package provides development files for dleyna-connector-dbus.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+ --disable-silent-rules
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/dleyna-1.0/connectors/*.la
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS ChangeLog README
+%attr(755,root,root) %{_libdir}/dleyna-1.0/connectors/libdleyna-connector-dbus.so
+
+%files devel
+%defattr(644,root,root,755)
+%{_pkgconfigdir}/dleyna-connector-dbus-1.0.pc
diff --git a/0001-Connector-Don-t-crash-when-trying-to-unwatch-non-exi.patch b/0001-Connector-Don-t-crash-when-trying-to-unwatch-non-exi.patch
new file mode 100644
index 0000000..db22c7e
--- /dev/null
+++ b/0001-Connector-Don-t-crash-when-trying-to-unwatch-non-exi.patch
@@ -0,0 +1,87 @@
+From c06ce2520886d42e3489c6a4abf5735e6bb080b9 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray <debarshir at freedesktop.org>
+Date: Mon, 19 Jan 2015 19:24:05 +0100
+Subject: [PATCH] [Connector] Don't crash when trying to unwatch non-existent
+ client
+
+$ gdbus call \
+ --session \
+ --dest com.intel.dleyna-renderer \
+ --object-path /com/intel/dLeynaRenderer \
+ --method com.intel.dLeynaRenderer.Manager.Release
+
+If a service is spawned as a result of the above command, then it will
+lead to a crash with this backtrace:
+
+ (client_name=0x7f7c94009750 ":1.603") at src/connector-dbus.c:271
+ (conn=<optimized out>, sender=0x7f7c94009750 ":1.603",
+ object=<optimized out>, interface=<optimized out>,
+ method=<optimized out>, parameters=<optimized out>,
+ invocation=0x2360e00) at server.c:780
+ at gdbusconnection.c:4884
+ at gmain.c:3111
+ (context=context at entry=0x2342ea0) at gmain.c:3710
+ block=block at entry=1, dispatch=dispatch at entry=1,
+ self=<optimized out>) at gmain.c:3781
+ at gmain.c:3975
+ (server=<optimized out>, control_point=<optimized out>,
+ user_data=0x0) at libdleyna/core/main-loop.c:155
+ argv=<optimized out>) at daemon.c:93
+
+This is because g_hash_table_lookup returns NULL which we try to
+dereference to get the client_id.
+
+Instead of our hand-spun solution for storing unsigned integers in a
+GHashTable, let's use standard GLib mechanisms for doing that. We
+avoid this problem and reduce a g_new/g_free pair as a bonus.
+---
+ src/connector-dbus.c | 11 ++++-------
+ 1 file changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/src/connector-dbus.c b/src/connector-dbus.c
+index 0e16239..83774c0 100644
+--- a/src/connector-dbus.c
++++ b/src/connector-dbus.c
+@@ -173,7 +173,7 @@ static gboolean prv_connector_initialize(const gchar *server_info,
+ g_context.objects = g_hash_table_new_full(g_direct_hash, g_direct_equal,
+ g_free, prv_free_dbus_object);
+ g_context.clients = g_hash_table_new_full(g_str_hash, g_str_equal,
+- g_free, g_free);
++ g_free, NULL);
+
+ g_context.root_node_info = g_dbus_node_info_new_for_xml(root_info,
+ NULL);
+@@ -268,8 +268,8 @@ static void prv_connector_unwatch_client(const gchar *client_name)
+
+ DLEYNA_LOG_DEBUG("Enter");
+
+- client_id = *(guint *)g_hash_table_lookup(g_context.clients,
+- client_name);
++ client_id = GPOINTER_TO_UINT(g_hash_table_lookup(g_context.clients,
++ client_name));
+ (void) g_hash_table_remove(g_context.clients, client_name);
+
+ g_bus_unwatch_name(client_id);
+@@ -287,7 +287,6 @@ static void prv_lost_client(GDBusConnection *connection, const gchar *name,
+ static gboolean prv_connector_watch_client(const gchar *client_name)
+ {
+ guint watch_id;
+- guint *client_id;
+ gboolean added = TRUE;
+
+ DLEYNA_LOG_DEBUG("Enter");
+@@ -301,10 +300,8 @@ static gboolean prv_connector_watch_client(const gchar *client_name)
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ NULL, prv_lost_client, NULL,
+ NULL);
+- client_id = g_new(guint, 1);
+- *client_id = watch_id;
+ g_hash_table_insert(g_context.clients, g_strdup(client_name),
+- client_id);
++ GUINT_TO_POINTER(watch_id));
+
+ out:
+ DLEYNA_LOG_DEBUG("Exit");
+--
+2.1.0
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/dleyna-connector-dbus.git/commitdiff/f0401976ffb12487c9885a719b73726b80997066
More information about the pld-cvs-commit
mailing list