GNOME Bugzilla – Bug 532907
memory leak in Accessible_getHostApplication()
Last modified: 2008-11-18 03:07:39 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.
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.