diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h index 912e3be15f..1123dc6b18 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h @@ -543,7 +543,7 @@ struct _Ecore_X_Event_Selection_Request Ecore_X_Window requestor; Ecore_X_Time time; Ecore_X_Atom selection; - Ecore_X_Atom target; + char *target; Ecore_X_Atom property; }; diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_events.c b/legacy/ecore/src/lib/ecore_x/ecore_x_events.c index 5b87f3476a..fa942b43f5 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_events.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_events.c @@ -166,6 +166,15 @@ _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev) free(e); } +static void +_ecore_x_event_free_selection_request(void *data __UNUSED__, void *ev) +{ + Ecore_X_Event_Selection_Request *e; + + XFree(e->target); + free(e); +} + static void _ecore_x_event_free_selection_notify(void *data __UNUSED__, void *ev) { @@ -1120,9 +1129,9 @@ _ecore_x_event_handle_selection_request(XEvent *xevent) e->requestor = xevent->xselectionrequest.requestor; e->time = xevent->xselectionrequest.time; e->selection = xevent->xselectionrequest.selection; - e->target = xevent->xselectionrequest.target; + e->target = XGetAtomName(_ecore_x_disp, xevent->xselectionrequest.target); e->property = xevent->xselectionrequest.property; - ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL); + ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, _ecore_x_event_free_selection_request, NULL); if ((sd = _ecore_x_selection_get(xevent->xselectionrequest.selection)) && (sd->win == xevent->xselectionrequest.owner)) diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c b/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c index e7e9d712f6..a5cb4ecf05 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c @@ -277,6 +277,8 @@ _ecore_x_selection_target_atom_get(const char *target) char * _ecore_x_selection_target_get(Ecore_X_Atom target) { + /* FIXME: Should not return mem allocated with strdup or X mixed, + * one should use free to free, the other XFree */ if (target == ECORE_X_ATOM_FILE_NAME) return strdup(ECORE_X_SELECTION_TARGET_FILENAME); else if (target == ECORE_X_ATOM_STRING)