diff options
author | 2010-12-19 01:18:07 +0000 | |
---|---|---|
committer | 2010-12-19 01:18:07 +0000 | |
commit | d1271ea48a3ba8c12e67fe8459982fb272fd8c03 (patch) | |
tree | 5725cc2f03e498afe8bcc3f148e2cc834a57dc48 /sys-apps/dbus | |
parent | old (diff) | |
download | gentoo-2-d1271ea48a3ba8c12e67fe8459982fb272fd8c03.tar.gz gentoo-2-d1271ea48a3ba8c12e67fe8459982fb272fd8c03.tar.bz2 gentoo-2-d1271ea48a3ba8c12e67fe8459982fb272fd8c03.zip |
punt old
(Portage version: 2.2.0_alpha9/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/dbus')
-rw-r--r-- | sys-apps/dbus/Manifest | 3 | ||||
-rw-r--r-- | sys-apps/dbus/dbus-1.2.24-r1.ebuild | 128 | ||||
-rw-r--r-- | sys-apps/dbus/dbus-1.2.24-r2.ebuild | 171 | ||||
-rw-r--r-- | sys-apps/dbus/files/dbus-1.2.24-thread-safety.patch | 393 |
4 files changed, 0 insertions, 695 deletions
diff --git a/sys-apps/dbus/Manifest b/sys-apps/dbus/Manifest index fb4da273d4f7..56dde4246e50 100644 --- a/sys-apps/dbus/Manifest +++ b/sys-apps/dbus/Manifest @@ -1,12 +1,9 @@ AUX 30-dbus 243 RMD160 b5e7a813cd5d91f2ea60bb22260e432cbfb72fd9 SHA1 35ee3a5d3db9c7e372603ce916e17a41edd01d36 SHA256 a8e8fec9769cc5d46df8216f7d1e1f9df422c4e46f293fd70d4b017fb01d959d AUX 80-dbus 341 RMD160 3b7f55906289d91a1f0ed87edec7902ddac076c5 SHA1 df1f96934fbe164dc4f4e2e4d4b4cdeaf8cef2b5 SHA256 76ce25ce8769cdfcb0d7b7e52e5a7e6474448fc34e8ad9393afac1eca1e07fd2 -AUX dbus-1.2.24-thread-safety.patch 14117 RMD160 5333f686b14ac911bca8d4ade056d3afb7987421 SHA1 e69219e91516ca9d61cb6b88e9c84429839d79bb SHA256 dad08d5821a14ab7a40443045525cf3ef9a417b9195711956d563d843d0847b4 AUX dbus-1.4.0-asneeded.patch 4157 RMD160 f6fd613ff90d5570f4dabeca0738df4c3249ed49 SHA1 ceddf63bb4a3213f68117b36af415a7c69443e6a SHA256 c37d068b6923947f769682677cacbad13b267458b2de242e160b8ab261aa9b96 AUX dbus.init-1.0 1152 RMD160 f0f409b59167beef2e2b8c14f701fbeaa54c3bc9 SHA1 b00e23868046c67eaec87220e92ffcea5d9dd911 SHA256 a2e13a025faa488ff35521188c0d44909bc82c55e8676a24a5a5179545303d98 DIST dbus-1.2.24.tar.gz 1673774 RMD160 2f51def784056bc16fbec2ddc3be22c022a94fb5 SHA1 9593717348ea36ba228b46f165bb67c127c12be8 SHA256 f12c748f4a703655e3d4c3db94cdf5a752a0cd0b36958c715804373bd3595c48 DIST dbus-1.4.0.tar.gz 1800347 RMD160 e3d44208f39d7c4a1bf916527dc121d3097a82d0 SHA1 4be3281005a9ef8f521f5547128c29a2632cb1d7 SHA256 c96d2f86d40e158e2bf405925a0a42cce0533a8466098e2f2238aa1614926652 -EBUILD dbus-1.2.24-r1.ebuild 3707 RMD160 811ff2f77ab26cf12cb3aabfbf4ff5caba283bf1 SHA1 66e8910d474d93523c4b43ca490ef62b5dece465 SHA256 b790060d03e5855ff3bdb2551de82859418e0a43be05098238a138715f515a73 -EBUILD dbus-1.2.24-r2.ebuild 4675 RMD160 3878f1edd150a5faebb5cd11424b6475e40f973b SHA1 aa23bc36f4aadb49a09e40e43586dc98d2373029 SHA256 6219b5c8e9ec336c3f6558945a7e4f789509f8f171c1b085b1de3aac83c1b5ad EBUILD dbus-1.2.24.ebuild 3679 RMD160 5d4063a79bddee8c3963d68487862bf3638acf0d SHA1 26f2043c6a5d92a567fc92b8dfcba1e6eeee7d09 SHA256 897662b0d33783ef5876b3db04739964d2425f5d24d6242f8ad9ab1680b421bc EBUILD dbus-1.4.0.ebuild 5111 RMD160 03aa2d02e41a5173f5780815c038f09fec133015 SHA1 946470a558d5d4902987e8b43e88003c1334ed58 SHA256 93546a9afa1ac0e875c41342fa09a8f5a0d40d1f0085fbd6578fc258fcc3fe00 MISC ChangeLog 40844 RMD160 c9beb7f44f1876e056d3c5706b3d88fb2b233876 SHA1 06a5ae9f20dc683e823948c0f2ecb3fe6d632499 SHA256 d8a806f2d5b79eabbdadbf6e2dc2a04386acc2b30b11b58f264c50ab6d1ed9f8 diff --git a/sys-apps/dbus/dbus-1.2.24-r1.ebuild b/sys-apps/dbus/dbus-1.2.24-r1.ebuild deleted file mode 100644 index 9919debec766..000000000000 --- a/sys-apps/dbus/dbus-1.2.24-r1.ebuild +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/dbus/dbus-1.2.24-r1.ebuild,v 1.1 2010/08/05 19:54:03 lack Exp $ - -EAPI=2 - -inherit eutils multilib flag-o-matic - -DESCRIPTION="A message bus system, a simple way for applications to talk to each other" -HOMEPAGE="http://dbus.freedesktop.org/" -SRC_URI="http://dbus.freedesktop.org/releases/dbus/${P}.tar.gz" - -LICENSE="|| ( GPL-2 AFL-2.1 )" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" -IUSE="debug doc selinux test X" - -RDEPEND="X? ( x11-libs/libXt x11-libs/libX11 ) - selinux? ( sys-libs/libselinux - sec-policy/selinux-dbus ) - >=dev-libs/expat-1.95.8 - !<sys-apps/dbus-0.91" -DEPEND="${RDEPEND} - dev-util/pkgconfig - doc? ( app-doc/doxygen - app-text/xmlto )" - -pkg_setup() { - enewgroup messagebus - enewuser messagebus -1 "-1" -1 messagebus -} - -src_prepare() { - # Tests were restricted because of this - sed -e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \ - -e '/"dispatch"/d' -i "${S}/bus/test-main.c" -} - -src_configure() { - # so we can get backtraces from apps - append-flags -rdynamic - - # libaudit is *only* used in DBus wrt SELinux support, so disable it, if - # not on an SELinux profile. - econf \ - $(use_with X x) \ - $(use_enable kernel_linux inotify) \ - $(use_enable kernel_FreeBSD kqueue) \ - $(use_enable selinux) \ - $(use_enable selinux libaudit) \ - $(use_enable debug verbose-mode) \ - $(use_enable debug asserts) \ - $(use_enable test tests) \ - $(use_enable test asserts) \ - --with-xml=expat \ - --with-system-pid-file=/var/run/dbus.pid \ - --with-system-socket=/var/run/dbus/system_bus_socket \ - --with-session-socket-dir=/tmp \ - --with-dbus-user=messagebus \ - --localstatedir=/var \ - $(use_enable doc doxygen-docs) \ - --disable-xml-docs \ - || die "econf failed" - - # after the compile, it uses a selinuxfs interface to - # check if the SELinux policy has the right support - use selinux && addwrite /selinux/access -} - -src_test() { - DBUS_VERBOSE=1 make check || die "make check failed" -} - -src_install() { - emake DESTDIR="${D}" install || die "make install failed" - - # initscript - newinitd "${FILESDIR}"/dbus.init-1.0 dbus - - if use X ; then - # dbus X session script (#77504) - # turns out to only work for GDM (and startx). has been merged into - # other desktop (kdm and such scripts) - exeinto /etc/X11/xinit/xinitrc.d/ - doexe "${FILESDIR}"/80-dbus - fi - - # needs to exist for the system socket - keepdir /var/run/dbus - # needs to exist for machine id - keepdir /var/lib/dbus - # needs to exist for dbus sessions to launch - - keepdir /usr/lib/dbus-1.0/services - keepdir /usr/share/dbus-1/services - keepdir /etc/dbus-1/system.d/ - keepdir /etc/dbus-1/session.d/ - - dodoc AUTHORS ChangeLog HACKING NEWS README doc/TODO - if use doc; then - dohtml doc/*html - fi -} - -pkg_postinst() { - elog "To start the D-Bus system-wide messagebus by default" - elog "you should add it to the default runlevel :" - elog "\`rc-update add dbus default\`" - elog - elog "Some applications require a session bus in addition to the system" - elog "bus. Please see \`man dbus-launch\` for more information." - elog - ewarn "You must restart D-Bus \`/etc/init.d/dbus restart\` to run" - ewarn "the new version of the daemon." - - if has_version x11-base/xorg-server[hal]; then - elog - ewarn "You are currently running X with the hal useflag enabled" - ewarn "restarting the dbus service WILL restart X as well" - ebeep 5 - fi - - if use test; then - elog - ewarn "You have unit tests enabled, this results in an insecure library" - ewarn "It is recommended that you reinstall *without* FEATURES=test" - fi -} diff --git a/sys-apps/dbus/dbus-1.2.24-r2.ebuild b/sys-apps/dbus/dbus-1.2.24-r2.ebuild deleted file mode 100644 index aee9b3900a69..000000000000 --- a/sys-apps/dbus/dbus-1.2.24-r2.ebuild +++ /dev/null @@ -1,171 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/dbus/dbus-1.2.24-r2.ebuild,v 1.2 2010/09/13 21:23:52 reavertm Exp $ - -EAPI="2" - -inherit eutils multilib flag-o-matic - -DESCRIPTION="A message bus system, a simple way for applications to talk to each other" -HOMEPAGE="http://dbus.freedesktop.org/" -SRC_URI="http://dbus.freedesktop.org/releases/dbus/${P}.tar.gz" - -LICENSE="|| ( GPL-2 AFL-2.1 )" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" -IUSE="debug doc selinux test X" - -RDEPEND="X? ( x11-libs/libXt x11-libs/libX11 ) - selinux? ( sys-libs/libselinux - sec-policy/selinux-dbus ) - >=dev-libs/expat-1.95.8 - !<sys-apps/dbus-0.91" -DEPEND="${RDEPEND} - dev-util/pkgconfig - doc? ( - app-doc/doxygen - app-text/xmlto - app-text/docbook-xml-dtd:4.1.2 )" - -# out of sources build directory -BD=${WORKDIR}/${P}-build -# out of sources build dir for make check -TBD=${WORKDIR}/${P}-tests-build - -pkg_setup() { - enewgroup messagebus - enewuser messagebus -1 "-1" -1 messagebus -} - -src_prepare() { - # Tests were restricted because of this - sed -e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \ - -e '/"dispatch"/d' -i "${S}/bus/test-main.c" || die "sed failed" - - # Thread safety patch, upstream #17754 - epatch "${FILESDIR}/${PN}-1.2.24-thread-safety.patch" -} - -src_configure() { - local my_conf - - # so we can get backtraces from apps - append-flags -rdynamic - - # libaudit is *only* used in DBus wrt SELinux support, so disable it, if - # not on an SELinux profile. - my_conf="$(use_with X x) - $(use_enable debug verbose-mode) - $(use_enable debug asserts) - $(use_enable kernel_linux inotify) - $(use_enable kernel_FreeBSD kqueue) - $(use_enable selinux) - $(use_enable selinux libaudit) - --with-xml=expat - --with-system-pid-file=/var/run/dbus.pid - --with-system-socket=/var/run/dbus/system_bus_socket - --with-session-socket-dir=/tmp - --with-dbus-user=messagebus - --localstatedir=/var" - - mkdir "${BD}" - cd "${BD}" - einfo "Running configure in ${BD}" - ECONF_SOURCE="${S}" econf ${my_conf} \ - $(use_enable doc doxygen-docs) \ - $(use_enable doc xml-docs) - - if use test; then - mkdir "${TBD}" - cd "${TBD}" - einfo "Running configure in ${TBD}" - ECONF_SOURCE="${S}" econf \ - ${my_conf} \ - $(use_enable test checks) \ - $(use_enable test tests) \ - $(use_enable test asserts) - fi -} - -src_compile() { - # after the compile, it uses a selinuxfs interface to - # check if the SELinux policy has the right support - use selinux && addwrite /selinux/access - - cd "${BD}" - einfo "Running make in ${BD}" - emake || die "make failed" - - if use doc; then - einfo "Building API documentation..." - doxygen || die "doxygen failed" - fi - - if use test; then - cd "${TBD}" - einfo "Running make in ${TBD}" - emake || die "make failed" - fi -} - -src_test() { - cd "${TBD}" - DBUS_VERBOSE=1 make check || die "make check failed" -} - -src_install() { - # initscript - newinitd "${FILESDIR}"/dbus.init-1.0 dbus || die "newinitd failed" - - if use X ; then - # dbus X session script (#77504) - # turns out to only work for GDM (and startx). has been merged into - # other desktop (kdm and such scripts) - exeinto /etc/X11/xinit/xinitrc.d/ - doexe "${FILESDIR}"/80-dbus || die "doexe failed" - fi - - # needs to exist for the system socket - keepdir /var/run/dbus - # needs to exist for machine id - keepdir /var/lib/dbus - # needs to exist for dbus sessions to launch - - keepdir /usr/lib/dbus-1.0/services - keepdir /usr/share/dbus-1/services - keepdir /etc/dbus-1/system.d/ - keepdir /etc/dbus-1/session.d/ - - dodoc AUTHORS ChangeLog HACKING NEWS README doc/TODO || die "dodoc failed" - - cd "${BD}" - # FIXME: split dtd's in dbus-dtd ebuild - emake DESTDIR="${D}" install || die "make install failed" - if use doc; then - dohtml -p api/ doc/api/html/* || die "dohtml api failed" - cd "${S}" - dohtml doc/*.html || die "dohtml failed" - fi -} - -pkg_postinst() { - elog "To start the D-Bus system-wide messagebus by default" - elog "you should add it to the default runlevel :" - elog "\`rc-update add dbus default\`" - elog - elog "Some applications require a session bus in addition to the system" - elog "bus. Please see \`man dbus-launch\` for more information." - elog - ewarn "You must restart D-Bus \`/etc/init.d/dbus restart\` to run" - ewarn "the new version of the daemon." - - if has_version x11-base/xorg-server[hal]; then - elog - ewarn "You are currently running X with the hal useflag enabled" - ewarn "restarting the dbus service WILL restart X as well" - ebeep 5 - fi - - # Ensure unique id is generated - dbus-uuidgen --ensure="${ROOT}"/var/lib/dbus/machine-id -} diff --git a/sys-apps/dbus/files/dbus-1.2.24-thread-safety.patch b/sys-apps/dbus/files/dbus-1.2.24-thread-safety.patch deleted file mode 100644 index 79ffd51e2dd0..000000000000 --- a/sys-apps/dbus/files/dbus-1.2.24-thread-safety.patch +++ /dev/null @@ -1,393 +0,0 @@ -https://bugs.freedesktop.org/show_bug.cgi?id=17754 - -backport from 6ff1d079316cb730a54b4e0e95bd3e6e31f439de (master) - -diff -ru ../dbus-1.2.24/dbus/dbus-connection.c ./dbus/dbus-connection.c ---- ../dbus-1.2.24/dbus/dbus-connection.c 2010-03-23 20:01:32.000000000 +0100 -+++ ./dbus/dbus-connection.c 2010-08-04 07:20:00.310381625 +0200 -@@ -73,6 +73,14 @@ - _dbus_mutex_unlock ((connection)->mutex); \ - } while (0) - -+#define SLOTS_LOCK(connection) do { \ -+ _dbus_mutex_lock ((connection)->slot_mutex); \ -+ } while (0) -+ -+#define SLOTS_UNLOCK(connection) do { \ -+ _dbus_mutex_unlock ((connection)->slot_mutex); \ -+ } while (0) -+ - #define DISPATCH_STATUS_NAME(s) \ - ((s) == DBUS_DISPATCH_COMPLETE ? "complete" : \ - (s) == DBUS_DISPATCH_DATA_REMAINS ? "data remains" : \ -@@ -257,6 +265,7 @@ - - DBusList *filter_list; /**< List of filters. */ - -+ DBusMutex *slot_mutex; /**< Lock on slot_list so overall connection lock need not be taken */ - DBusDataSlotList slot_list; /**< Data stored by allocated integer ID */ - - DBusHashTable *pending_replies; /**< Hash of message serials to #DBusPendingCall. */ -@@ -647,39 +656,42 @@ - DBusWatchToggleFunction toggle_function, - dbus_bool_t enabled) - { -- DBusWatchList *watches; - dbus_bool_t retval; -- -+ - HAVE_LOCK_CHECK (connection); - -- /* This isn't really safe or reasonable; a better pattern is the "do everything, then -- * drop lock and call out" one; but it has to be propagated up through all callers -+ /* The original purpose of protected_change_watch() was to hold a -+ * ref on the connection while dropping the connection lock, then -+ * calling out to the app. This was a broken hack that did not -+ * work, since the connection was in a hosed state (no WatchList -+ * field) while calling out. -+ * -+ * So for now we'll just keep the lock while calling out. This means -+ * apps are not allowed to call DBusConnection methods inside a -+ * watch function or they will deadlock. -+ * -+ * The "real fix" is to use the _and_unlock() pattern found -+ * elsewhere in the code, to defer calling out to the app until -+ * we're about to drop locks and return flow of control to the app -+ * anyway. -+ * -+ * See http://lists.freedesktop.org/archives/dbus/2007-July/thread.html#8144 - */ -- -- watches = connection->watches; -- if (watches) -- { -- connection->watches = NULL; -- _dbus_connection_ref_unlocked (connection); -- CONNECTION_UNLOCK (connection); - -+ if (connection->watches) -+ { - if (add_function) -- retval = (* add_function) (watches, watch); -+ retval = (* add_function) (connection->watches, watch); - else if (remove_function) - { - retval = TRUE; -- (* remove_function) (watches, watch); -+ (* remove_function) (connection->watches, watch); - } - else - { - retval = TRUE; -- (* toggle_function) (watches, watch, enabled); -+ (* toggle_function) (connection->watches, watch, enabled); - } -- -- CONNECTION_LOCK (connection); -- connection->watches = watches; -- _dbus_connection_unref_unlocked (connection); -- - return retval; - } - else -@@ -768,39 +780,42 @@ - DBusTimeoutToggleFunction toggle_function, - dbus_bool_t enabled) - { -- DBusTimeoutList *timeouts; - dbus_bool_t retval; -- -+ - HAVE_LOCK_CHECK (connection); - -- /* This isn't really safe or reasonable; a better pattern is the "do everything, then -- * drop lock and call out" one; but it has to be propagated up through all callers -+ /* The original purpose of protected_change_timeout() was to hold a -+ * ref on the connection while dropping the connection lock, then -+ * calling out to the app. This was a broken hack that did not -+ * work, since the connection was in a hosed state (no TimeoutList -+ * field) while calling out. -+ * -+ * So for now we'll just keep the lock while calling out. This means -+ * apps are not allowed to call DBusConnection methods inside a -+ * timeout function or they will deadlock. -+ * -+ * The "real fix" is to use the _and_unlock() pattern found -+ * elsewhere in the code, to defer calling out to the app until -+ * we're about to drop locks and return flow of control to the app -+ * anyway. -+ * -+ * See http://lists.freedesktop.org/archives/dbus/2007-July/thread.html#8144 - */ -- -- timeouts = connection->timeouts; -- if (timeouts) -- { -- connection->timeouts = NULL; -- _dbus_connection_ref_unlocked (connection); -- CONNECTION_UNLOCK (connection); - -+ if (connection->timeouts) -+ { - if (add_function) -- retval = (* add_function) (timeouts, timeout); -+ retval = (* add_function) (connection->timeouts, timeout); - else if (remove_function) - { - retval = TRUE; -- (* remove_function) (timeouts, timeout); -+ (* remove_function) (connection->timeouts, timeout); - } - else - { - retval = TRUE; -- (* toggle_function) (timeouts, timeout, enabled); -+ (* toggle_function) (connection->timeouts, timeout, enabled); - } -- -- CONNECTION_LOCK (connection); -- connection->timeouts = timeouts; -- _dbus_connection_unref_unlocked (connection); -- - return retval; - } - else -@@ -1239,6 +1254,10 @@ - if (connection->io_path_cond == NULL) - goto error; - -+ _dbus_mutex_new_at_location (&connection->slot_mutex); -+ if (connection->slot_mutex == NULL) -+ goto error; -+ - disconnect_message = dbus_message_new_signal (DBUS_PATH_LOCAL, - DBUS_INTERFACE_LOCAL, - "Disconnected"); -@@ -1315,6 +1334,7 @@ - _dbus_mutex_free_at_location (&connection->mutex); - _dbus_mutex_free_at_location (&connection->io_path_mutex); - _dbus_mutex_free_at_location (&connection->dispatch_mutex); -+ _dbus_mutex_free_at_location (&connection->slot_mutex); - dbus_free (connection); - } - if (pending_replies) -@@ -2558,9 +2578,14 @@ - - /* The connection lock is better than the global - * lock in the atomic increment fallback -+ * -+ * (FIXME but for now we always use the atomic version, -+ * to avoid taking the connection lock, due to -+ * the mess with set_timeout_functions()/set_watch_functions() -+ * calling out to the app without dropping locks) - */ - --#ifdef DBUS_HAVE_ATOMIC_INT -+#if 1 - _dbus_atomic_inc (&connection->refcount); - #else - CONNECTION_LOCK (connection); -@@ -2672,6 +2697,8 @@ - _dbus_mutex_free_at_location (&connection->io_path_mutex); - _dbus_mutex_free_at_location (&connection->dispatch_mutex); - -+ _dbus_mutex_free_at_location (&connection->slot_mutex); -+ - _dbus_mutex_free_at_location (&connection->mutex); - - dbus_free (connection); -@@ -2706,9 +2733,14 @@ - - /* The connection lock is better than the global - * lock in the atomic increment fallback -+ * -+ * (FIXME but for now we always use the atomic version, -+ * to avoid taking the connection lock, due to -+ * the mess with set_timeout_functions()/set_watch_functions() -+ * calling out to the app without dropping locks) - */ - --#ifdef DBUS_HAVE_ATOMIC_INT -+#if 1 - last_unref = (_dbus_atomic_dec (&connection->refcount) == 1); - #else - CONNECTION_LOCK (connection); -@@ -4652,9 +4684,11 @@ - * should be that dbus_connection_set_watch_functions() has no effect, - * but the add_function and remove_function may have been called. - * -- * @todo We need to drop the lock when we call the -- * add/remove/toggled functions which can be a side effect -- * of setting the watch functions. -+ * @note The thread lock on DBusConnection is held while -+ * watch functions are invoked, so inside these functions you -+ * may not invoke any methods on DBusConnection or it will deadlock. -+ * See the comments in the code or http://lists.freedesktop.org/archives/dbus/2007-July/tread.html#8144 -+ * if you encounter this issue and want to attempt writing a patch. - * - * @param connection the connection. - * @param add_function function to begin monitoring a new descriptor. -@@ -4673,42 +4707,17 @@ - DBusFreeFunction free_data_function) - { - dbus_bool_t retval; -- DBusWatchList *watches; - - _dbus_return_val_if_fail (connection != NULL, FALSE); - - CONNECTION_LOCK (connection); - --#ifndef DBUS_DISABLE_CHECKS -- if (connection->watches == NULL) -- { -- _dbus_warn_check_failed ("Re-entrant call to %s is not allowed\n", -- _DBUS_FUNCTION_NAME); -- return FALSE; -- } --#endif -- -- /* ref connection for slightly better reentrancy */ -- _dbus_connection_ref_unlocked (connection); -- -- /* This can call back into user code, and we need to drop the -- * connection lock when it does. This is kind of a lame -- * way to do it. -- */ -- watches = connection->watches; -- connection->watches = NULL; -- CONNECTION_UNLOCK (connection); -- -- retval = _dbus_watch_list_set_functions (watches, -+ retval = _dbus_watch_list_set_functions (connection->watches, - add_function, remove_function, - toggled_function, - data, free_data_function); -- CONNECTION_LOCK (connection); -- connection->watches = watches; -- -+ - CONNECTION_UNLOCK (connection); -- /* drop our paranoid refcount */ -- dbus_connection_unref (connection); - - return retval; - } -@@ -4738,6 +4747,12 @@ - * given remove_function. The timer interval may change whenever the - * timeout is added, removed, or toggled. - * -+ * @note The thread lock on DBusConnection is held while -+ * timeout functions are invoked, so inside these functions you -+ * may not invoke any methods on DBusConnection or it will deadlock. -+ * See the comments in the code or http://lists.freedesktop.org/archives/dbus/2007-July/thread.html#8144 -+ * if you encounter this issue and want to attempt writing a patch. -+ * - * @param connection the connection. - * @param add_function function to add a timeout. - * @param remove_function function to remove a timeout. -@@ -4755,38 +4770,17 @@ - DBusFreeFunction free_data_function) - { - dbus_bool_t retval; -- DBusTimeoutList *timeouts; - - _dbus_return_val_if_fail (connection != NULL, FALSE); - - CONNECTION_LOCK (connection); - --#ifndef DBUS_DISABLE_CHECKS -- if (connection->timeouts == NULL) -- { -- _dbus_warn_check_failed ("Re-entrant call to %s is not allowed\n", -- _DBUS_FUNCTION_NAME); -- return FALSE; -- } --#endif -- -- /* ref connection for slightly better reentrancy */ -- _dbus_connection_ref_unlocked (connection); -- -- timeouts = connection->timeouts; -- connection->timeouts = NULL; -- CONNECTION_UNLOCK (connection); -- -- retval = _dbus_timeout_list_set_functions (timeouts, -+ retval = _dbus_timeout_list_set_functions (connection->timeouts, - add_function, remove_function, - toggled_function, - data, free_data_function); -- CONNECTION_LOCK (connection); -- connection->timeouts = timeouts; -- -+ - CONNECTION_UNLOCK (connection); -- /* drop our paranoid refcount */ -- dbus_connection_unref (connection); - - return retval; - } -@@ -5749,6 +5743,15 @@ - * the connection is finalized. The slot number - * must have been allocated with dbus_connection_allocate_data_slot(). - * -+ * @note This function does not take the -+ * main thread lock on DBusConnection, which allows it to be -+ * used from inside watch and timeout functions. (See the -+ * note in docs for dbus_connection_set_watch_functions().) -+ * A side effect of this is that you need to know there's -+ * a reference held on the connection while invoking -+ * dbus_connection_set_data(), or the connection could be -+ * finalized during dbus_connection_set_data(). -+ * - * @param connection the connection - * @param slot the slot number - * @param data the data to store -@@ -5768,14 +5771,14 @@ - _dbus_return_val_if_fail (connection != NULL, FALSE); - _dbus_return_val_if_fail (slot >= 0, FALSE); - -- CONNECTION_LOCK (connection); -+ SLOTS_LOCK (connection); - - retval = _dbus_data_slot_list_set (&slot_allocator, - &connection->slot_list, - slot, data, free_data_func, - &old_free_func, &old_data); - -- CONNECTION_UNLOCK (connection); -+ SLOTS_UNLOCK (connection); - - if (retval) - { -@@ -5791,6 +5794,15 @@ - * Retrieves data previously set with dbus_connection_set_data(). - * The slot must still be allocated (must not have been freed). - * -+ * @note This function does not take the -+ * main thread lock on DBusConnection, which allows it to be -+ * used from inside watch and timeout functions. (See the -+ * note in docs for dbus_connection_set_watch_functions().) -+ * A side effect of this is that you need to know there's -+ * a reference held on the connection while invoking -+ * dbus_connection_get_data(), or the connection could be -+ * finalized during dbus_connection_get_data(). -+ * - * @param connection the connection - * @param slot the slot to get data from - * @returns the data, or #NULL if not found -@@ -5803,13 +5815,13 @@ - - _dbus_return_val_if_fail (connection != NULL, NULL); - -- CONNECTION_LOCK (connection); -+ SLOTS_LOCK (connection); - - res = _dbus_data_slot_list_get (&slot_allocator, - &connection->slot_list, - slot); - -- CONNECTION_UNLOCK (connection); -+ SLOTS_UNLOCK (connection); - - return res; - } |