After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 532907 - memory leak in Accessible_getHostApplication()
memory leak in Accessible_getHostApplication()
Status: RESOLVED FIXED
Product: at-spi
Classification: Platform
Component: cbindings
1.22.x
Other All
: Normal critical
: ---
Assigned To: Li Yuan
Li Yuan
Depends on:
Blocks:
 
 
Reported: 2008-05-13 07:37 UTC by orenl
Modified: 2008-11-18 03:07 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
patch (463 bytes, patch)
2008-11-14 02:45 UTC, Li Yuan
committed Details | Review

Description orenl 2008-05-13 07:37:33 UTC
Please describe the problem:
I think that the function Accessible_getHostApplication() (in the C binding) takes double references to the AccessibleApplication* that it returns. 
Thus, instead of calling AccessibleApplication_unref() twice on the resulting pointer, one has to call it twice. 

Steps to reproduce:
Run the simplest AT-SPI C program with this snippet:

Accessibility *a;
AccessibilityApplication *ap;

SPI_init();
...
/* assume 'a' has a valid pointer */
ap = Accessible_getHostApplication(a);
if (ap) {
  AccessibleApplication_unref(ap);
  /* AccessibleApplication_unref(ap); */
}
...
printf("ref counts: %d\n", SPI_exit());
...


Actual results:
the output is "1" where it should have been "0".
if the second unref is uncommented, the output becomes correct.

Expected results:


Does this happen every time?


Other information:
the obvious workaround in the program I'm developing is to do the unreference twice to match the excessive reference.
Comment 1 Li Yuan 2008-11-14 02:45:35 UTC
Created attachment 122624 [details] [review]
patch

This call is equal to Accessibility_Accessible_getApplication to get the application object first, and then Accessible_getApplication to get the desktop interface. So the reference is two.