Overview
| Artifact ID: | 0accb979cb8e0227e778175c54a1fa6c573fc04c |
|---|---|
| Ticket: | 570902ffffffffffffffffffffffffffffffffff |
| Date: | 2002-06-19 09:29:33 |
| User: | mdejong |
| Artifact Attached: | db9986ce4588aaa2efec85fa1ec0da7995ef2cc9 |
| Filename: | im.c |
| Description: | Minimal test case for XCloseIM bug |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48#include <X11/Xlib.h> #include <stdlib.h> #include <locale.h> int main() { Display *d; int screen; Window window; XIM im; XIC ic; if (setlocale(LC_CTYPE, "") == NULL) exit(1); if (! XSupportsLocale() ) exit(2); d = XOpenDisplay(":0.0"); if (d == NULL) exit(3); screen = DefaultScreen(d); window = XCreateSimpleWindow(d, RootWindow(d, screen), 0, 0, 200, 200, 2, BlackPixel(d, screen), WhitePixel(d, screen)); im = XOpenIM(d, NULL, NULL, NULL); if (im == NULL) exit(4); if( (ic = XCreateIC(im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, window, NULL)) == NULL ) exit(5); /* The XCloseIM method can free the same memory twice because of a bug in the close method for a specific input context. This fix is to NULL out the im->core.ic_chain member after freeing the elements of the queue. This should be done by X, but we can avoid the bug by calling XDestroyIC ourselves. */ /*XDestroyIC(ic);*/ XCloseIM(im); XCloseDisplay(d); }
