discomfitor pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=5a13ab03857cda9e52d9f258eb15d23baa73504f
commit 5a13ab03857cda9e52d9f258eb15d23baa73504f Author: Mike Blumenkrantz <[email protected]> Date: Fri Jul 28 13:49:30 2017 -0400 handle xwl data source cleanup more effectively ensure source is freed and references to it are unset when changing selection --- src/modules/xwayland/dnd.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/modules/xwayland/dnd.c b/src/modules/xwayland/dnd.c index 9ad5afbf7..8867017ab 100644 --- a/src/modules/xwayland/dnd.c +++ b/src/modules/xwayland/dnd.c @@ -144,6 +144,12 @@ _xwayland_send_send(E_Comp_Wl_Data_Source *source EINA_UNUSED, const char* mime_ } static void +_xwayland_send_cancelled(E_Comp_Wl_Data_Source *source) +{ + e_comp_wl_clipboard_source_unref((void*)source); +} + +static void _xwayland_cancelled_send(E_Comp_Wl_Data_Source *source EINA_UNUSED) { DBG("XWL Data Source Cancelled Send"); @@ -234,9 +240,14 @@ _xwl_fixes_selection_notify(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_X_Even { if (ev->owner) { - if (e_comp_wl->clipboard.source) - e_comp_wl_clipboard_source_unref(e_comp_wl->clipboard.source); + if (e_comp_wl->selection.data_source) + { + E_Comp_Wl_Data_Source *psource = e_comp_wl->selection.data_source; + if (psource->cancelled) + psource->cancelled(psource); + } e_comp_wl->clipboard.source = NULL; + e_comp_wl->selection.data_source = NULL; e_comp_wl->clipboard.xwl_owner = ev->owner; xconvertselection(ecore_x_display_get(), ECORE_X_ATOM_SELECTION_CLIPBOARD, ECORE_X_ATOM_SELECTION_TARGETS, xwl_dnd_atom, e_comp->cm_selection, 0); @@ -279,6 +290,7 @@ _xwl_selection_notify(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_X_Event_Sele e_comp_wl->selection.data_source = &source->data_source; source->data_source.resource = dsource->resource; source->data_source.send = _xwayland_send_send; + source->data_source.cancelled = _xwayland_send_cancelled; if (e_client_has_xwindow(e_client_focused_get())) e_comp_wl_data_device_keyboard_focus_set(); return ECORE_CALLBACK_RENEW; --
