aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/alarm-notify/notify-main.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 7e94b4054c..c9bee9ebdb 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2005-10-03 Chenthill Palanisamy <pchenthill@novell.com>
+
+ Fixes #271480
+ * gui/alarm-notify/notify-main.c: (alarm_notify_factory_fn),
+ (init_alarm_service): Added a global static mutex to ensure
+ the alarm_notify object is created only once.
+
2005-10-03 Mubeen Jukaku <jmubeen@novell.com>
Fixes #264449
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c
index b6f60222b5..4dca946d76 100644
--- a/calendar/gui/alarm-notify/notify-main.c
+++ b/calendar/gui/alarm-notify/notify-main.c
@@ -52,6 +52,8 @@ static BonoboGenericFactory *factory;
static AlarmNotify *alarm_notify_service = NULL;
+/* to ensure alarm_notify object is created only once */
+GStaticMutex mutex_init = G_STATIC_MUTEX_INIT;
/* Callback for the master client's "die" signal. We must terminate the daemon
* since the session is ending.
@@ -104,6 +106,7 @@ init_session (void)
static BonoboObject *
alarm_notify_factory_fn (BonoboGenericFactory *factory, const char *component_id, void *data)
{
+ g_static_mutex_lock (&mutex_init);
if (!alarm_notify_service) {
alarm_notify_service = alarm_notify_new ();
g_assert (alarm_notify_service != NULL);
@@ -111,6 +114,7 @@ alarm_notify_factory_fn (BonoboGenericFactory *factory, const char *component_id
bonobo_object_ref (BONOBO_OBJECT (alarm_notify_service));
+ g_static_mutex_unlock (&mutex_init);
return BONOBO_OBJECT (alarm_notify_service);
}
@@ -118,10 +122,13 @@ alarm_notify_factory_fn (BonoboGenericFactory *factory, const char *component_id
static gboolean
init_alarm_service (gpointer user_data)
{
+ if (!g_static_mutex_trylock (&mutex_init))
+ return FALSE;
if (!alarm_notify_service) {
alarm_notify_service = alarm_notify_new ();
g_assert (alarm_notify_service != NULL);
}
+ g_static_mutex_unlock (&mutex_init);
return FALSE;
}