Enlightenment CVS committal Author : rephorm Project : e17 Module : proto
Dir : e17/proto/e_dbus/src/lib/dbus Modified Files: E_DBus.h e_dbus_object.c e_dbus_private.h Log Message: cleanups and debugging export interface ref/unref plug leak in introspection data add some debugging for introspection make callback struct opaque =================================================================== RCS file: /cvs/e/e17/proto/e_dbus/src/lib/dbus/E_DBus.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- E_DBus.h 11 Jul 2007 00:47:19 -0000 1.11 +++ E_DBus.h 11 Jul 2007 00:48:17 -0000 1.12 @@ -24,6 +24,17 @@ typedef void (*E_DBus_Object_Property_Get_Cb) (E_DBus_Object *obj, const char *property, int *type, void **value); typedef int (*E_DBus_Object_Property_Set_Cb) (E_DBus_Object *obj, const char *property, int type, void *value); +/** + * A callback function for a DBus call + * @param user_data the data passed in to the method call + * @param event_data a struct containing the return data. + */ +typedef void (*E_DBus_Callback_Func) (void *user_data, void *method_return, DBusError *error); +typedef DBusMessage *(*E_DBus_Unmarshal_Func) (DBusMessage *msg, DBusError *err); + +typedef struct E_DBus_Callback E_DBus_Callback; + + int e_dbus_init(void); void e_dbus_shutdown(void); @@ -38,6 +49,8 @@ /* receiving method calls */ E_DBus_Interface *e_dbus_interface_new(const char *interface); +void e_dbus_interface_ref(E_DBus_Interface *iface); +void e_dbus_interface_unref(E_DBus_Interface *iface); void e_dbus_object_interface_attach(E_DBus_Object *obj, E_DBus_Interface *iface); int e_dbus_interface_method_add(E_DBus_Interface *iface, const char *member, const char *signature, const char *reply_signature, E_DBus_Method_Cb func); @@ -54,6 +67,8 @@ DBusPendingCall *e_dbus_message_send(E_DBus_Connection *conn, DBusMessage *msg, E_DBus_Method_Return_Cb cb_return, int timeout, void *data); +DBusPendingCall *e_dbus_method_call_send(E_DBus_Connection *conn, DBusMessage *msg, E_DBus_Unmarshal_Func unmarshal_func, E_DBus_Callback_Func cb_func, int timeout, void *data); + /* signal receiving */ @@ -106,21 +121,6 @@ void *value, E_DBus_Method_Return_Cb cb_return, void *data); -/** - * A callback function for a DBus call - * @param user_data the data passed in to the method call - * @param event_data a struct containing the return data. - */ -typedef void (*E_DBus_Callback_Func) (void *user_data, void *method_return, DBusError *error); -typedef DBusMessage *(*E_DBus_Unmarshal_Func) (DBusMessage *msg, DBusError *err); - -typedef struct E_DBus_Callback E_DBus_Callback; -struct E_DBus_Callback -{ - E_DBus_Callback_Func cb_func; - E_DBus_Unmarshal_Func unmarshal_func; - void *user_data; -}; E_DBus_Callback *e_dbus_callback_new(E_DBus_Callback_Func cb_func, E_DBus_Unmarshal_Func unmarshal_func, void *user_data); =================================================================== RCS file: /cvs/e/e17/proto/e_dbus/src/lib/dbus/e_dbus_object.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- e_dbus_object.c 11 Jul 2007 00:44:54 -0000 1.10 +++ e_dbus_object.c 11 Jul 2007 00:48:17 -0000 1.11 @@ -15,8 +15,6 @@ static void e_dbus_object_unregister(DBusConnection *conn, void *user_data); static DBusHandlerResult e_dbus_object_handler(DBusConnection *conn, DBusMessage *message, void *user_data); -static void e_dbus_interface_ref(E_DBus_Interface *iface); -static void e_dbus_interface_unref(E_DBus_Interface *iface); static void e_dbus_interface_free(E_DBus_Interface *iface); static E_DBus_Method *e_dbus_method_new(const char *member, const char *signature, const char *reply_signature, E_DBus_Method_Cb func); @@ -84,6 +82,7 @@ return ret; } + if (obj->introspection_data) free(obj->introspection_data); obj->introspection_data = strdup(ecore_strbuf_string_get(buf)); ecore_strbuf_free(buf); } @@ -235,7 +234,7 @@ { if (!obj) return; - DEBUG(5, "e_dbus_object_free\n"); + DEBUG(5, "e_dbus_object_free (%s)\n", obj->path); dbus_connection_unregister_object_path(obj->conn->conn, obj->path); e_dbus_connection_unref(obj->conn); @@ -284,17 +283,20 @@ e_dbus_interface_ref(iface); ecore_list_append(obj->interfaces, iface); obj->introspection_dirty = 1; + DEBUG(4, "e_dbus_object_interface_attach (%s, %s) ", obj->path, iface->name); } -static void +void e_dbus_interface_ref(E_DBus_Interface *iface) { iface->refcount++; + DEBUG(4, "e_dbus_interface_ref (%s) = %d\n", iface->name, iface->refcount); } -static void +void e_dbus_interface_unref(E_DBus_Interface *iface) { + DEBUG(4, "e_dbus_interface_unref (%s) = %d\n", iface->name, iface->refcount - 1); if (--(iface->refcount) == 0) e_dbus_interface_free(iface); } @@ -326,6 +328,7 @@ E_DBus_Method *m; m = e_dbus_method_new(member, signature, reply_signature, func); + DEBUG(4, "Add method %s: %p\n", member, m); if (!m) return 0; ecore_list_append(iface->methods, m); @@ -482,6 +485,7 @@ ecore_strbuf_append(buf, "\">\n"); level++; + DEBUG(4, "introspect iface: %s\n", iface->name); ecore_list_goto_first(iface->methods); while ((method = ecore_list_next(iface->methods))) _introspect_method_append(buf, method, level); @@ -497,6 +501,7 @@ char *type; _introspect_indent_append(buf, level); + DEBUG(4, "introspect method: %s\n", method->member); ecore_strbuf_append(buf, "<method name=\""); ecore_strbuf_append(buf, method->member); ecore_strbuf_append(buf, "\">\n"); =================================================================== RCS file: /cvs/e/e17/proto/e_dbus/src/lib/dbus/e_dbus_private.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_dbus_private.h 22 Mar 2007 07:15:23 -0000 1.2 +++ e_dbus_private.h 11 Jul 2007 00:48:17 -0000 1.3 @@ -18,6 +18,13 @@ int refcount; }; +struct E_DBus_Callback +{ + E_DBus_Callback_Func cb_func; + E_DBus_Unmarshal_Func unmarshal_func; + void *user_data; +}; + int e_dbus_object_init(void); void e_dbus_object_shutdown(void); ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs