Ken Brown <kbr...@cornell.edu> writes:

>>> I haven't the cygwin notebook with me, next access for me is tomorrow.
>>> I'll check then.

I couldn't do it today, unfortunately.

>> Yes, that's it.  Emacs does freeze if I load dbus.el and the system bus
>> isn't running.  But the problem doesn't occur in a build of Emacs from
>> the trunk.  I vaguely recall that someone reported this problem last
>> summer, and you fixed it.  But maybe you only fixed it in the trunk, and
>> not in the emacs-23 branch.  Do I remember that correctly?

In the trunk, we have rewritten D-Bus integration into the main
loop. xd_pending_messages, which I believe is the source of our pain,
does not exist any longer in the trunk.

> Here's what I was thinking of:
>
>   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6579

Yep. Reading the code, I have the feeling, that the following patch
should help:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs-23/src/dbusbind.c.~100084~  2010-10-07 
16:44:04.632300629 +0200
--- /home/albinus/src/emacs-23/src/dbusbind.c   2010-10-07 16:41:25.000000000 
+0200
***************
*** 1571,1577 ****

  /* Check, whether there is pending input in the message queue of the
     D-Bus BUS.  BUS is a Lisp symbol, either :system or :session.  */
! int
  xd_get_dispatch_status (bus)
       Lisp_Object bus;
  {
--- 1571,1577 ----

  /* Check, whether there is pending input in the message queue of the
     D-Bus BUS.  BUS is a Lisp symbol, either :system or :session.  */
! static Lisp_Object
  xd_get_dispatch_status (bus)
       Lisp_Object bus;
  {
***************
*** 1587,1609 ****
    return
      (dbus_connection_get_dispatch_status (connection)
       == DBUS_DISPATCH_DATA_REMAINS)
!     ? TRUE : FALSE;
  }

  /* Check for queued incoming messages from the system and session buses.  */
  int
  xd_pending_messages ()
  {

    /* Vdbus_registered_objects_table will be initialized as hash table
       in dbus.el.  When this package isn't loaded yet, it doesn't make
       sense to handle D-Bus messages.  */
!   return (HASH_TABLE_P (Vdbus_registered_objects_table)
!         ? (xd_get_dispatch_status (QCdbus_system_bus)
!            || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL)
!                ? xd_get_dispatch_status (QCdbus_session_bus)
!                : FALSE))
!         : FALSE);
  }

  /* Read queued incoming message of the D-Bus BUS.  BUS is a Lisp
--- 1587,1617 ----
    return
      (dbus_connection_get_dispatch_status (connection)
       == DBUS_DISPATCH_DATA_REMAINS)
!     ? Qt : Qnil;
  }

  /* Check for queued incoming messages from the system and session buses.  */
  int
  xd_pending_messages ()
  {
+   int ret;
+   xd_in_read_queued_messages = 1;

    /* Vdbus_registered_objects_table will be initialized as hash table
       in dbus.el.  When this package isn't loaded yet, it doesn't make
       sense to handle D-Bus messages.  */
!   ret = (HASH_TABLE_P (Vdbus_registered_objects_table)
!        ? (!NILP (internal_catch (Qdbus_error, xd_get_dispatch_status,
!                                   QCdbus_system_bus))
!           || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL)
!               ? (!NILP (internal_catch (Qdbus_error, xd_get_dispatch_status,
!                                         QCdbus_session_bus)))
!               : FALSE))
!        : FALSE);
!
!   /* Return.  */
!   xd_in_read_queued_messages = 0;
!   return ret;
  }

  /* Read queued incoming message of the D-Bus BUS.  BUS is a Lisp
--8<---------------cut here---------------end--------------->8---

At least it doesn't hurt under GNU/Linux :-)

> Ken

Best regards, Michael.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to