fix case where dbus fd could have two handlers added
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 27 Nov 2011 18:05:44 +0000 (18:05 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 27 Nov 2011 18:05:44 +0000 (18:05 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@65615 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/dbus/e_dbus.c

index 4b3b7e4..9bd361c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,3 +36,7 @@
 2011-11-11  Carsten Haitzler (The Rasterman)
 
         * Fix DSO linking to edbus to include libdbus linking and includes
+
+2011-11-27  Mike Blumenkrantz
+
+        * Fix case where fd handler could be added twice for dbus fd
diff --git a/NEWS b/NEWS
index e47da8b..6b76c29 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Fixes:
     * DSO linking issues fixed
     * crash on e-notify-send with invalid session bus set
     * when app has no idle time, e_dbus's idlers dont process anything
+    * error when trying to add duplicate fd handler for dbus fd
 
 Improvements:
 
index 024b4c6..17ee612 100644 (file)
@@ -83,16 +83,24 @@ e_dbus_fd_handler_add(E_DBus_Handler_Data *hd)
 {
   unsigned int dflags;
   Ecore_Fd_Handler_Flags eflags;
+  Eina_List *l;
+  Ecore_Fd_Handler *fdh;
 
   if (hd->fd_handler) return;
-  DBG("fd handler add (%d)", hd->fd);
-
   dflags = dbus_watch_get_flags(hd->watch);
   eflags = ECORE_FD_ERROR;
   if (dflags & DBUS_WATCH_READABLE) eflags |= ECORE_FD_READ;
   if (dflags & DBUS_WATCH_WRITABLE) eflags |= ECORE_FD_WRITE;
 
+  EINA_LIST_FOREACH(hd->cd->fd_handlers, l, fdh)
+    {
+       if (ecore_main_fd_handler_fd_get(fdh) != hd->fd) continue;
+       DBG("fd handler mod (%d)", hd->fd);
+       ecore_main_fd_handler_active_set(fdh, eflags);
+       return;
+    }
 
+  DBG("fd handler add (%d)", hd->fd);
   hd->fd_handler = ecore_main_fd_handler_add(hd->fd,
                                              eflags,
                                              e_dbus_fd_handler,