[evolution-patches] [PATCH] prevent evolution from crashing if new-mail-notification is enabled but D-BUS session daemon is not running
- From: Timo Hoenig <thoenig suse de>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] [PATCH] prevent evolution from crashing if new-mail-notification is enabled but D-BUS session daemon is not running
- Date: Wed, 06 Apr 2005 15:25:23 +0200
Hi,
Evolution crashes if the new-mail-notification plugin is enabled and
gconf key is set to true but the D-BUS session daemon is not running.
Attached is a fix which adds the appropriate checks.
Additionally, the plugin now refuses to load once it is enabled but the
address of the D-BUS session daemon can not be determined.
Thanks,
Timo
Index: plugins/new-mail-notify/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/new-mail-notify/ChangeLog,v
retrieving revision 1.6
diff -u -r1.6 ChangeLog
--- plugins/new-mail-notify/ChangeLog 5 Apr 2005 07:28:15 -0000 1.6
+++ plugins/new-mail-notify/ChangeLog 6 Apr 2005 13:14:50 -0000
@@ -1,3 +1,11 @@
+2005-04-06 Timo Hoenig <thoenig novell com>
+ * new-mail-notify.c (send_dbus_message): added two checks to prevent
+ Evolution to crash if the D-BUS session bus is not running or if
+ D-BUS is not able to allocate memory for the message
+ * new-mail-notify.c (e_plugin_lib_enable): refuse to load the plugin
+ if the address of the D-BUS session bus can not be determined
+ * new-mail-notify.c (e_plugin_lib_enable): new function
+
2005-03-11 David Malcolm <dmalcolm redhat com>
* new-mail-notify.c: preprocessor hackery using the value of
Index: plugins/new-mail-notify/new-mail-notify.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/new-mail-notify/new-mail-notify.c,v
retrieving revision 1.4
diff -u -r1.4 new-mail-notify.c
--- plugins/new-mail-notify/new-mail-notify.c 5 Apr 2005 07:28:15 -0000 1.4
+++ plugins/new-mail-notify/new-mail-notify.c 6 Apr 2005 13:14:50 -0000
@@ -42,6 +42,7 @@
GtkWidget *org_gnome_new_mail_config (EPlugin *ep, EConfigHookItemFactoryData *hook_data);
void org_gnome_new_mail_notify (EPlugin *ep, EMEventTargetFolder *t);
void org_gnome_message_reading_notify (EPlugin *ep, EMEventTargetMessage *t);
+int e_plugin_lib_enable(EPluginLib *ep, int enable);
static void
toggled_cb (GtkWidget *widget, EConfig *config)
@@ -101,6 +102,8 @@
if (!bus) {
printf ("Failed to connect to the D-BUS daemon: %s\n", error.message);
dbus_error_free (&error);
+ g_object_unref (client);
+ return;
}
/* Set up this connection to work in a GLib event loop */
@@ -111,6 +114,11 @@
DBUS_INTERFACE,
message_name);
+ if (message == NULL) {
+ g_object_unref (client);
+ return;
+ }
+
/* Appends the data as an argument to the message */
dbus_message_append_args (message,
#if DBUS_VERSION >= 310
@@ -145,3 +153,18 @@
{
send_dbus_message ("Newmail", t->uri);
}
+
+int
+e_plugin_lib_enable (EPluginLib *ep, int enable)
+{
+ if (enable) {
+ if (getenv("DBUS_SESSION_BUS_ADDRESS") == NULL) {
+ /* Could not determine address of the D-BUS session bus */
+ /* Plugin will be disabled */
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]