[Commits] [SCM] claws branch, master, updated. 3.16.0-187-g5a6f38f

wwp at claws-mail.org wwp at claws-mail.org
Mon May 28 17:17:38 CEST 2018


The branch, master has been updated
       via  5a6f38fbc4c27229cc2fe8d7d6d878d7354e8d1b (commit)
      from  f3607fd481989d942e0c112848d559e00344a07d (commit)

Summary of changes:
 src/plugins/vcalendar/vcal_dbus.c |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit 5a6f38fbc4c27229cc2fe8d7d6d878d7354e8d1b
Author: wwp <wwp at free.fr>
Date:   Mon May 28 17:17:05 2018 +0200

    Dynamically allocate interface_vtable.

diff --git a/src/plugins/vcalendar/vcal_dbus.c b/src/plugins/vcalendar/vcal_dbus.c
index 05add6d..c716031 100644
--- a/src/plugins/vcalendar/vcal_dbus.c
+++ b/src/plugins/vcalendar/vcal_dbus.c
@@ -125,13 +125,7 @@ static void handle_method_call (GDBusConnection       *connection,
 }
 
 
-static const GDBusInterfaceVTable interface_vtable =
-{
-	handle_method_call,
-	NULL,
-	NULL,
-	{0,0,0,0,0,0,0,0}
-};
+static GDBusInterfaceVTable* interface_vtable = NULL;
 
 static GDBusNodeInfo *introspection_data = NULL;
 static GDBusInterfaceInfo *interface_info = NULL;
@@ -167,10 +161,13 @@ static void bus_acquired(GDBusConnection *connection,
 			 gpointer         user_data)
 {
 	GError *err = NULL;
+
+	cm_return_if_fail(interface_vtable);
+
 	g_dbus_connection_register_object(connection,
 		"/org/gnome/Shell/CalendarServer",
 		introspection_data->interfaces[0],
-		&interface_vtable, NULL, NULL, &err);
+		(const GDBusInterfaceVTable *)interface_vtable, NULL, NULL, &err);
 	if (err != NULL)
 		debug_print("Error: %s\n", err->message);
 }
@@ -178,13 +175,18 @@ static void bus_acquired(GDBusConnection *connection,
 void connect_dbus(void)
 {
 	debug_print("connect_dbus() invoked\n");
+
+	interface_vtable = g_malloc0(sizeof(GDBusInterfaceVTable));
+	cm_return_if_fail(interface_vtable);
+	interface_vtable->method_call = (GDBusInterfaceMethodCallFunc)handle_method_call;
+
 	introspection_data = g_dbus_node_info_new_for_xml(
 				introspection_xml, NULL);
 	if (introspection_data == NULL) {
 		debug_print("Couldn't figure out XML.\n");
 		return;
 	}
-	
+
 	interface_info = g_dbus_node_info_lookup_interface(
 				introspection_data,
 				"org.gnome.Shell.CalendarServer");
@@ -202,6 +204,9 @@ void disconnect_dbus(void)
 {
 	debug_print("disconnect_dbus() invoked\n");
 	g_bus_unown_name(dbus_own_id);
+
+	g_free(interface_vtable);
+	interface_vtable = NULL;
 }
 
 #else

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list