forked from enlightenment/enlightenment
xwayland dnd - handle names not being allocated
fix CID 1403921
This commit is contained in:
parent
8c76ff3e32
commit
e96cff8503
|
@ -186,52 +186,56 @@ _xwl_fixes_selection_notify(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_X_Even
|
||||||
Ecore_X_Atom *types = (void*)data;
|
Ecore_X_Atom *types = (void*)data;
|
||||||
|
|
||||||
names = malloc(num * sizeof(void*));
|
names = malloc(num * sizeof(void*));
|
||||||
namelist = eina_array_new(num);
|
if (names)
|
||||||
for (i = 0; i < num; i++)
|
|
||||||
{
|
{
|
||||||
char *name;
|
namelist = eina_array_new(num);
|
||||||
|
for (i = 0; i < num; i++)
|
||||||
if (types[i] == string_atom)
|
|
||||||
{
|
{
|
||||||
name = names[i] = strdup("UTF8_STRING");
|
char *name;
|
||||||
eina_array_push(namelist, eina_stringshare_add(WL_TEXT_STR));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
names[i] = name = ecore_x_atom_name_get(types[i]);
|
|
||||||
DBG("XWL TARGET: %s", name);
|
|
||||||
eina_array_push(namelist, eina_stringshare_add(name));
|
|
||||||
}
|
|
||||||
if (num > 3)
|
|
||||||
{
|
|
||||||
ecore_x_window_prop_property_set(e_comp->cm_selection,
|
|
||||||
ECORE_X_ATOM_XDND_TYPE_LIST, ECORE_X_ATOM_ATOM, 32, names, num);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (types[i] == string_atom)
|
||||||
|
{
|
||||||
|
name = names[i] = strdup("UTF8_STRING");
|
||||||
|
eina_array_push(namelist, eina_stringshare_add(WL_TEXT_STR));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
names[i] = name = ecore_x_atom_name_get(types[i]);
|
||||||
|
DBG("XWL TARGET: %s", name);
|
||||||
|
eina_array_push(namelist, eina_stringshare_add(name));
|
||||||
|
}
|
||||||
|
if (num > 3)
|
||||||
|
{
|
||||||
|
ecore_x_window_prop_property_set(e_comp->cm_selection,
|
||||||
|
ECORE_X_ATOM_XDND_TYPE_LIST, ECORE_X_ATOM_ATOM, 32, names, num);
|
||||||
|
}
|
||||||
|
}
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
|
if (names)
|
||||||
e_comp_wl->drag_client = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->owner);
|
{
|
||||||
if (!e_comp_wl->drag_client) e_comp_wl->drag_client = e_comp_wl->ptr.ec;
|
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
|
||||||
e_comp_wl->drag = e_drag_new(x, y, (const char**)names, num, NULL, 0, NULL, _xwayland_drop);
|
e_comp_wl->drag_client = e_pixmap_find_client(E_PIXMAP_TYPE_X, ev->owner);
|
||||||
e_comp_wl->drag->button_mask = evas_pointer_button_down_mask_get(e_comp->evas);
|
if (!e_comp_wl->drag_client) e_comp_wl->drag_client = e_comp_wl->ptr.ec;
|
||||||
ecore_x_window_move_resize(e_comp->cm_selection, 0, 0, e_comp->w, e_comp->h);
|
e_comp_wl->drag = e_drag_new(x, y, (const char**)names, num, NULL, 0, NULL, _xwayland_drop);
|
||||||
ecore_x_window_show(e_comp->cm_selection);
|
e_comp_wl->drag->button_mask = evas_pointer_button_down_mask_get(e_comp->evas);
|
||||||
e_drag_start(e_comp_wl->drag, x, y);
|
ecore_x_window_move_resize(e_comp->cm_selection, 0, 0, e_comp->w, e_comp->h);
|
||||||
if (e_comp_wl->ptr.ec)
|
ecore_x_window_show(e_comp->cm_selection);
|
||||||
e_comp_wl_data_device_send_enter(e_comp_wl->ptr.ec);
|
e_drag_start(e_comp_wl->drag, x, y);
|
||||||
e_comp_canvas_feed_mouse_up(0);
|
if (e_comp_wl->ptr.ec)
|
||||||
source = e_comp_wl_data_manager_source_create(e_comp_wl->xwl_client,
|
e_comp_wl_data_device_send_enter(e_comp_wl->ptr.ec);
|
||||||
e_comp_wl->mgr.resource, 0);
|
e_comp_canvas_feed_mouse_up(0);
|
||||||
source->current_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
source = e_comp_wl_data_manager_source_create(e_comp_wl->xwl_client,
|
||||||
source->dnd_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
e_comp_wl->mgr.resource, 0);
|
||||||
e_comp_wl->drag_source = source;
|
source->current_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
||||||
source->target = _xwayland_target_send;
|
source->dnd_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
||||||
source->send = _xwayland_send_send;
|
e_comp_wl->drag_source = source;
|
||||||
source->cancelled = _xwayland_cancelled_send;
|
source->target = _xwayland_target_send;
|
||||||
source->mime_types = namelist;
|
source->send = _xwayland_send_send;
|
||||||
for (i = 0; i < num; i++)
|
source->cancelled = _xwayland_cancelled_send;
|
||||||
free(names[i]);
|
source->mime_types = namelist;
|
||||||
free(names);
|
for (i = 0; i < num; i++) free(names[i]);
|
||||||
|
free(names);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue