unify client mouse action ending

the code for this in most places was identical, but in some places it was
not, leading to behavior inconsistencies and potentially dangling objects
This commit is contained in:
Mike Blumenkrantz 2016-01-21 14:29:10 -05:00
parent ec0cbc7ead
commit 945eafd791
1 changed files with 16 additions and 33 deletions

View File

@ -412,6 +412,17 @@ _e_client_action_finish(void)
action_client = NULL;
}
static void
_e_client_mouse_action_end(E_Client *ec)
{
if (!ec->cur_mouse_action) return;
if (ec->cur_mouse_action->func.end_mouse)
ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
else if (ec->cur_mouse_action->func.end)
ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
}
static void
_e_client_revert_focus(E_Client *ec)
{
@ -586,11 +597,7 @@ _e_client_del(E_Client *ec)
ec->exe_inst = NULL;
}
if (ec->cur_mouse_action)
{
if (ec->cur_mouse_action->func.end)
ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
}
_e_client_mouse_action_end(ec);
if (action_client == ec) _e_client_action_finish();
e_pointer_type_pop(e_comp->pointer, ec, NULL);
@ -1388,14 +1395,7 @@ _e_client_cb_evas_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN
if (stopping) return; //ignore all of this if we're shutting down!
if (e_object_is_del(data)) return; //client is about to die
if (ec->cur_mouse_action)
{
if (ec->cur_mouse_action->func.end_mouse)
ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
else if (ec->cur_mouse_action->func.end)
ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
E_FREE_FUNC(ec->cur_mouse_action, e_object_unref);
}
_e_client_mouse_action_end(ec);
if (action_client == ec) _e_client_action_finish();
e_pointer_type_pop(e_comp->pointer, ec, NULL);
@ -2908,14 +2908,7 @@ e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_
/* also we don't pass the same params that went in - then again that */
/* should be ok as we are just ending the action if it has an end */
if (ec->cur_mouse_action)
{
if (ec->cur_mouse_action->func.end_mouse)
ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", ev);
else if (ec->cur_mouse_action->func.end)
ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
e_object_unref(E_OBJECT(ec->cur_mouse_action));
ec->cur_mouse_action = NULL;
}
_e_client_mouse_action_end(ec);
else
{
if (!e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(ec), ev))
@ -4590,12 +4583,7 @@ e_client_move_cancel(void)
ec = ecmove;
e_object_ref(E_OBJECT(ec));
if (ec->cur_mouse_action->func.end_mouse)
ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
else if (ec->cur_mouse_action->func.end)
ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
e_object_unref(E_OBJECT(ec->cur_mouse_action));
ec->cur_mouse_action = NULL;
_e_client_mouse_action_end(ec);
e_object_unref(E_OBJECT(ec));
}
else
@ -4612,12 +4600,7 @@ e_client_resize_cancel(void)
ec = ecresize;
e_object_ref(E_OBJECT(ec));
if (ec->cur_mouse_action->func.end_mouse)
ec->cur_mouse_action->func.end_mouse(E_OBJECT(ec), "", NULL);
else if (ec->cur_mouse_action->func.end)
ec->cur_mouse_action->func.end(E_OBJECT(ec), "");
e_object_unref(E_OBJECT(ec->cur_mouse_action));
ec->cur_mouse_action = NULL;
_e_client_mouse_action_end(ec);
e_object_unref(E_OBJECT(ec));
}
else