| Ticket UUID: | 570902 | |||
| Title: | Patch to fix crashes in XCloseIM | |||
| Type: | Patch | Version: | None | |
| Submitter: | mdejong | Created on: | 2002-06-19 02:18:35 | |
| Subsystem: | 65. Generic Window Operations | Assigned To: | mdejong | |
| Priority: | 8 | Severity: | ||
| Status: | Closed | Last Modified: | 2002-06-20 02:39:51 | |
| Resolution: | Accepted | Closed By: | mdejong | |
| Closed on: | 2002-06-19 19:39:51 | |||
| Description: |
After many hours of searching and patching, I think I have finally fixed all the X input context issues that were causing crashes in XCloseIM or XCloseDisplay. These crashes were a result of a bug in X, so our only hope is to work around them. I sent a patch for the problem into the XFree86 project. but that will not cover existing systems. The basic problem is that you need to call XDestroyIC for every input context created by XCreateIC. We were missing some for the "special" windows created by the send command and the clipboard. This lead to invalid memory accesses in XCloseIM and things could get random after that. My original approach was to just hack some XDestroyIC call in, but that was not the best approach. The real fix was to make it possible to invoke Tk_DestroyWindow on the special windows created by the send and clipboard methods. That required a little rework of the shutdown sequence since this was not handled before. I have tested this quite a bit, this patch should solve the strange crashing I have been seeing without introducing any others. | |||
| User Comments: |
mdejong added on 2002-06-20 02:39:51:
Logged In: YES user_id=90858 Checked in on 2002-06-19. dgp added on 2002-06-19 23:51:32: Logged In: YES user_id=80530 Applying only xim.patch4 to the HEAD gets rid of all tktest segfaults. Mo rocks! mdejong added on 2002-06-19 09:53:51: File Added - 25372: xim_peek.patch mdejong added on 2002-06-19 09:53:50: Logged In: YES user_id=90858 The attached patch makes it much easier to find the problem since it will panic before a crash has a chance to happen. I have only tested it with XFree86, but it sounds like other X systems have the same bug and likely the same layout of the XIM structure. hobbs added on 2002-06-19 09:39:29: Logged In: YES user_id=72656 temporarily assigning to dgp, as he was able to more consistently crash whereas mine were more sporadic. mdejong added on 2002-06-19 09:29:33: File Added - 25370: im.c Logged In: YES user_id=90858 I have also attached a minimal test case that shows the XCloseIM() bug in action and how to work around it. This would need to be compiled with a malloc debug library like efence to see the crash. mdejong added on 2002-06-19 09:18:35: File Added - 25369: xim.patch4 | |||
Attachments:
- xim_peek.patch [download] added by mdejong on 2002-06-19 09:53:51. [details]
- im.c [download] added by mdejong on 2002-06-19 09:29:33. [details]
- xim.patch4 [download] added by mdejong on 2002-06-19 09:18:35. [details]
