rem: char desc[tb->used+1];
add: if(tPtr->delegate && tPtr->delegate->didDoubleClickOnPicture) { char *desc;  desc = wmalloc(tb->used+1);
context: handleActionEvents(XEvent *event, void *data){    Text *tPtr = (Text *)data;    Display *dpy = event->xany.display;    KeySym ksym;        switch (event->type) {        case KeyPress:            ksym = XLookupKeysym((XKeyEvent*)event, 0);              if (ksym == XK_Shift_R || ksym == XK_Shift_L) {                 tPtr->flags.extendSelection = True;                return;            }             if (tPtr->flags.focused) {                XGrabPointer(dpy, W_VIEW(tPtr)->window, False,                     PointerMotionMask|ButtonPressMask|ButtonReleaseMask,                    GrabModeAsync, GrabModeAsync, None,                     tPtr->view->screen->invisibleCursor, CurrentTime);                tPtr->flags.pointerGrabbed = True;                handleTextKeyPress(tPtr, event);                            } break;        case KeyRelease:            ksym = XLookupKeysym((XKeyEvent*)event, 0);              if (ksym == XK_Shift_R || ksym == XK_Shift_L) {                tPtr->flags.extendSelection = False;                return;            /* end modify flag so selection can be extended */            }         break;        case MotionNotify:            if (tPtr->flags.pointerGrabbed) {                tPtr->flags.pointerGrabbed = False;                XUngrabPointer(dpy, CurrentTime);            }               if(tPtr->flags.waitingForSelection)                break;            if ((event->xmotion.state & Button1Mask)) {                TextBlock *tb = tPtr->currentTextBlock;                if(tb && tPtr->flags.isOverGraphic &&                        tb->graphic && !tb->object) {                    WMSize offs;                    WMPixmap *pixmap = tb->d.pixmap;                    char *types[2] = {"application/X-image", NULL};                    offs.width = 2;                    offs.height = 2;                    WMDragImageFromView(tPtr->view, pixmap, types,                        wmkpoint(event->xmotion.x_root, event->xmotion.y_root),                        offs, event, True);                                  } else {                    if (!tPtr->flags.ownsSelection) {                         WMCreateSelectionHandler(tPtr->view,                             XA_PRIMARY, event->xbutton.time,                             &selectionHandler, NULL);                        tPtr->flags.ownsSelection = True;                    }                }                selectRegion(tPtr, event->xmotion.x, event->xmotion.y);                break;            }             mouseOverObject(tPtr, event->xmotion.x, event->xmotion.y);        break;        case ButtonPress:             if (tPtr->flags.pointerGrabbed) {                tPtr->flags.pointerGrabbed = False;                XUngrabPointer(dpy, CurrentTime);                break;            }               if (tPtr->flags.waitingForSelection)                 break;            if (tPtr->flags.extendSelection && tPtr->flags.ownsSelection) {                selectRegion(tPtr, event->xmotion.x, event->xmotion.y);                return;            }             if (tPtr->flags.ownsSelection)                releaseSelection(tPtr);                        if (event->xbutton.button == Button1) {                 if(WMIsDoubleClick(event)) {                    TextBlock *tb = tPtr->currentTextBlock;                     tPtr->lastClickTime = event->xbutton.time;                    if(tb && tb->graphic && !tb->object) {                             char desc[tb->used+1];                            memcpy(desc, tb->text, tb->used);                            desc[tb->used] = 0;                        if(tPtr->delegate) {                        if(tPtr->delegate->didDoubleClickOnPicture)                            (*tPtr->delegate->didDoubleClickOnPicture)                                (tPtr->delegate, desc);                        }                     } else {                        autoSelectText(tPtr, 2);                    }                    break;                } else if(event->xbutton.time - tPtr->lastClickTime                    <  WINGsConfiguration.doubleClickDelay) {                  tPtr->lastClickTime = event->xbutton.time;                  autoSelectText(tPtr, 3);                  break;                }                if (!tPtr->flags.focused) {                    WMSetFocusToWidget(tPtr);                      tPtr->flags.focused = True;                }                    tPtr->lastClickTime = event->xbutton.time;                cursorToTextPosition(tPtr, event->xmotion.x, event->xmotion.y);                paintText(tPtr);           }             if (event->xbutton.button                 == WINGsConfiguration.mouseWheelDown)  {                WMScrollText(tPtr, 16);                break;            }            if (event->xbutton.button                 == WINGsConfiguration.mouseWheelUp)  {                WMScrollText(tPtr, -16);                break;            }            if (event->xbutton.button == Button2) {                char *text = NULL;                int n;                if (!tPtr->flags.editable) {                     XBell(dpy, 0);                    break;                 }                if (!WMRequestSelection(tPtr->view, XA_PRIMARY, XA_STRING,                    event->xbutton.time, pasteText, NULL)) {                    text = XFetchBuffer(tPtr->view->screen->display, &n, 0);                    tPtr->flags.waitingForSelection = 0;                       if (text) {                        text[n] = 0;                        if (tPtr->parser) {                            (tPtr->parser) (tPtr, (void *) text);                            layOutDocument(tPtr);                        }                        else                             insertTextInteractively(tPtr, text, n);                                            XFree(text);#if 0                        NOTIFY(tPtr, didChange, WMTextDidChangeNotification,                              (void*)WMInsertTextEvent);#endif                        updateCursorPosition(tPtr);                        paintText(tPtr);                    } else {                        tPtr->flags.waitingForSelection = True;                    }                }                 break;            }        case ButtonRelease:            if (tPtr->flags.pointerGrabbed) {                tPtr->flags.pointerGrabbed = False;                XUngrabPointer(dpy, CurrentTime);                break;            }               if (tPtr->flags.waitingForSelection)                 break;        }         }