changeset 638:7c569af3f656 trunk

[svn] - aosd: prevent aosd_cleanup from freeing stuff if aosd_init has never been called, closes bug #790
author giacomo
date Mon, 12 Feb 2007 08:02:53 -0800
parents a1687bd302ce
children 8f7a5883e08c
files ChangeLog src/aosd/aosd.c
diffstat 2 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Feb 12 07:20:56 2007 -0800
+++ b/ChangeLog	Mon Feb 12 08:02:53 2007 -0800
@@ -1,3 +1,10 @@
+2007-02-12 15:20:56 +0000  Giacomo Lozito <james@develia.org>
+  revision [1360]
+  - aosd: completed volume change trigger, works now
+  trunk/src/aosd/aosd_trigger.c |   50 +++++++++++++++++++++++++++++++++++++++---
+  1 file changed, 47 insertions(+), 3 deletions(-)
+
+
 2007-02-12 09:39:53 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1358]
   - update Welsh translation: ~75% completed
--- a/src/aosd/aosd.c	Mon Feb 12 07:20:56 2007 -0800
+++ b/src/aosd/aosd.c	Mon Feb 12 08:02:53 2007 -0800
@@ -26,6 +26,7 @@
 
 
 aosd_cfg_t * global_config = NULL;
+static gboolean plugin_is_active = FALSE;
 
 
 /* ***************** */
@@ -40,6 +41,7 @@
 void
 aosd_init ( void )
 {
+  plugin_is_active = TRUE;
   g_log_set_handler( NULL , G_LOG_LEVEL_WARNING , g_log_default_handler , NULL );
 
   global_config = aosd_cfg_new();
@@ -54,16 +56,21 @@
 void
 aosd_cleanup ( void )
 {
-  aosd_trigger_stop( &global_config->osd->trigger );
+  if ( plugin_is_active == TRUE )
+  {
+    aosd_trigger_stop( &global_config->osd->trigger );
 
-  aosd_shutdown();
+    aosd_shutdown();
 
-  if ( global_config != NULL )
-  {
-    aosd_cfg_delete( global_config );
-    global_config = NULL;
+    if ( global_config != NULL )
+    {
+      aosd_cfg_delete( global_config );
+      global_config = NULL;
+    }
+    
+    plugin_is_active = FALSE;
   }
-
+  
   return;
 }