Merge branch 'opendreambox' of /home/tmbinc/openembedded.git/ into opendreambox
[vuplus_openembedded] / packages / lesstif / files / 021_xim_chained_list_crash.diff
1 diff -ru lesstif2-0.94.4-old/lib/Xm-2.1/XmIm.c lesstif2-0.94.4/lib/Xm-2.1/XmIm.c
2 --- lesstif2-0.94.4-old/lib/Xm-2.1/XmIm.c       2004-10-20 21:32:11.000000000 +0200
3 +++ lesstif2-0.94.4/lib/Xm-2.1/XmIm.c   2007-03-28 14:39:27.000000000 +0200
4 @@ -133,7 +133,10 @@
5                 p->next = q->next;
6         }
7  
8 -       XtFree((char *)stuff);
9 +       /* if count!=0 then someone uses the stuff as orig_xim
10 +          so unlink it but not free it */
11 +       if (!stuff->count)
12 +               XtFree((char *)stuff);
13  }
14  
15  /*
16 @@ -1060,6 +1063,8 @@
17                    XCloseIM(stuff->xim);
18                 DEBUGOUT(_LtDebug(__FILE__, w, "XCloseIM(%p)\n", stuff->xim));
19                 stuff->orig_xim->xim = NULL;
20 +               /* stuff->orig_xim is now useless */
21 +               XtFree(stuff->orig_xim);
22         } else {
23                 DEBUGOUT(_LtDebug(__FILE__, w, "XmImCloseXIM(%p), count -> %d\n",
24                         stuff->xim, stuff->orig_xim->count));