[at-spi2-core] Fix some possible crashes and a memory leak



commit f56d3cf94f3b3a9ad1d290b033be3d31db3b667d
Author: Mike Gorse <mgorse novell com>
Date:   Wed Feb 2 12:51:17 2011 -0600

    Fix some possible crashes and a memory leak

 atspi/atspi-application.c |    3 +++
 atspi/atspi-misc.c        |    5 ++---
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/atspi/atspi-application.c b/atspi/atspi-application.c
index c2202a1..722d8aa 100644
--- a/atspi/atspi-application.c
+++ b/atspi/atspi-application.c
@@ -84,6 +84,9 @@ _atspi_application_new (const gchar *bus_name)
   
   application = g_object_new (ATSPI_TYPE_APPLICATION, NULL);
   if (application)
+  {
     application->bus_name = g_strdup (bus_name);
+    application->root = NULL;
+  }
   return application;
 }
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 9c4bf42..2adea05 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -182,7 +182,7 @@ get_application (const char *bus_name)
 
   if (!app_hash)
   {
-    app_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_hash_table_unref);
+    app_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_object_unref);
     if (!app_hash) return NULL;
   }
   app = g_hash_table_lookup (app_hash, bus_name);
@@ -192,7 +192,6 @@ get_application (const char *bus_name)
   // TODO: change below to something that will send state-change:defunct notification if necessary */
   app = _atspi_application_new (bus_name);
   if (!app) return NULL;
-  app->bus_name = bus_name_dup;
   app->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
   app->bus = dbus_connection_ref (_atspi_bus ());
   app->cache = ATSPI_CACHE_UNDEFINED;
@@ -562,7 +561,7 @@ _atspi_ref_accessible (const char *app, const char *path)
   if (!a) return NULL;
   if ( APP_IS_REGISTRY(a))
   {
-    return ref_accessible_desktop (a);
+    return a->root = ref_accessible_desktop (a);
   }
   return ref_accessible (app, path);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]