Track all XIC:s and destroy them explicitly to work around xfree86 bug.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14485 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2002-09-18 22:34:44 +00:00
parent 7ad3a88b9b
commit fb35644e9c
3 changed files with 42 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2002-09-19 00:33 Alexander Malmberg <alexander@malmberg.org>
* Header/x11/XGInputServer.h, Source/x11/XIMInputServer.m: Track
all created XIC:s and destroy them explicitly.
2002-09-18 19:59 Alexander Malmberg <alexander@malmberg.org>
* Source/art/blit.h, Source/art/blit.m, Source/art/composite.m:

View file

@ -45,6 +45,13 @@
XIMStyle xim_style;
NSMutableData *dbuf;
NSStringEncoding encoding;
/* Track the XIC:s and destroy them explicitly to work around an XFree86
bug:
http://www.xfree86.org/pipermail/xpert/2002-June/018370.html
*/
XIC *xics;
int num_xics;
}
- (id) initWithDelegate: (id)aDelegate

View file

@ -35,6 +35,7 @@
#include "x11/XGInputServer.h"
#include <X11/Xlocale.h>
@interface XIMInputServer (XIMPrivate)
- (BOOL) ximInit: (Display *)dpy;
- (void) ximClose;
@ -109,6 +110,7 @@
DESTROY(server_name);
DESTROY(dbuf);
[self ximClose];
[super dealloc];
}
/* ----------------------------------------------------------------------
@ -277,7 +279,17 @@
- (void) ximClose
{
int i;
for (i=0;i<num_xics;i++)
{
XDestroyIC(xics[i]);
}
free(xics);
num_xics=0;
xics=NULL;
NSDebugLLog(@"XIM", @"Closed XIM\n");
if (xim)
XCloseIM(xim);
xim=NULL;
@ -316,6 +328,9 @@
xim_style, NULL);
if (xic==NULL)
NSDebugLLog(@"XIM", @"Can't create the input context.\n");
xics = realloc(xics, sizeof(XIC) * (num_xics + 1));
xics[num_xics++] = xic;
return xic;
}
@ -330,6 +345,21 @@
- (void) ximCloseIC: (XIC)xic
{
int i;
for (i = 0; i < num_xics; i++)
{
if (xics[i] == xic)
break;
}
if (i == num_xics)
{
NSLog(@"internal error in ximCloseIC: can't find XIC in list");
abort();
}
for (i++; i < num_xics; i++)
xics[i - 1] = xics[i];
num_xics--;
XDestroyIC(xic);
}