[PATCH libXi] Destroy extension record after last display is removed

Chase Douglas chase.douglas at canonical.com
Mon Apr 23 07:01:30 PDT 2012


On 04/22/2012 10:08 PM, Peter Hutterer wrote:
> On Fri, Apr 20, 2012 at 03:30:30PM -0700, Chase Douglas wrote:
>> The extension record is currently leaked and never freed.
>>
>> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
>> ---
>>  src/XExtInt.c |   11 ++++++++++-
>>  1 files changed, 10 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/XExtInt.c b/src/XExtInt.c
>> index 43738a2..27638bd 100644
>> --- a/src/XExtInt.c
>> +++ b/src/XExtInt.c
>> @@ -434,7 +434,16 @@ XInputClose(
>>  	XFree((char *)((XInputData *) info->data)->vers);
>>  	XFree((char *)info->data);
>>      }
>> -    return XextRemoveDisplay(xinput_info, dpy);
>> +
>> +    if (!XextRemoveDisplay(xinput_info, dpy))
>> +        return 0;
>> +
>> +    if (xinput_info->ndisplays == 0) {
>> +        XextDestroyExtension(xinput_info);
>> +        xinput_info = NULL;
>> +    }
>> +
>> +    return 1;
>>  }
>>  
>>  static int
>> -- 
>> 1.7.9.1
> 
> with this patch applied and a grep over the libX* directories, we now have 2
> extensions calling XextDestroyExtension(). Can we automate this in
> XextRemoveDisplay somehow?

I think it would require API breaks, and this would fall way way near
the bottom of my todo list, tbh :(.

-- Chase


More information about the xorg-devel mailing list