2003-09-01 Padraig O'Briain <padraig.obriain@sun.com>
authorpadraigo <padraigo@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 1 Sep 2003 12:35:54 +0000 (12:35 +0000)
committerpadraigo <padraigo@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 1 Sep 2003 12:35:54 +0000 (12:35 +0000)
* cspi/spi_main.c (cspi_object_return): Ensure that reference count is
not decremented to zero. Fixes bug #120725.

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@539 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
cspi/spi_main.c

index 2a40fa9..6f5a657 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-01  Padraig O'Briain <padraig.obriain@sun.com>
+
+       * cspi/spi_main.c (cspi_object_return): Ensure that reference count is
+       not decremented to zero. Fixes bug #120725.
+
 2003-08-30  KAMAGASAKO Masatoshi  <emerald@gnome.gr.jp>
 
        * configure.in: Added "ja" to ALL_LINGUAS.
index f54b60a..b89a407 100644 (file)
@@ -268,6 +268,7 @@ cspi_object_borrow (CORBA_Object corba_object)
 void
 cspi_object_return (Accessible *accessible)
 {
+  int old_ref_count;
   g_return_if_fail (accessible != NULL);
 
   if (!accessible->on_loan ||
@@ -278,8 +279,17 @@ cspi_object_return (Accessible *accessible)
   else /* Convert to a permanant ref */
     {
       accessible->on_loan = FALSE;
+      old_ref_count = accessible->ref_count;
       accessible->objref = cspi_dup_ref (accessible->objref);
-      accessible->ref_count--;
+      if (old_ref_count != accessible->ref_count &&
+          accessible->ref_count == 1)
+        {
+            cspi_object_unref (accessible);
+        }
+      else    
+        {
+          accessible->ref_count--;
+        }
     }
 }