e comp: fix crashes on exit/restart when e_comp is NULL

when we are shutting down i seem to get into a state where e_comp is
null yet we are still processing events. this fixes that and checks.
This commit is contained in:
Carsten Haitzler 2016-02-04 23:58:05 +09:00
parent b9c45c6159
commit 26a7ba3a58
2 changed files with 9 additions and 0 deletions

View File

@ -1574,6 +1574,7 @@ e_comp_block_window_del(void)
E_API E_Comp *
e_comp_find_by_window(Ecore_Window win)
{
if (!e_comp) return NULL;
if ((e_comp->win == win) || (e_comp->ee_win == win) || (e_comp->root == win)) return e_comp;
return NULL;
}

View File

@ -1238,6 +1238,7 @@ _e_comp_x_show_request(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Eve
E_Client *ec;
//INF("X SHOW REQ: %u", ev->win);
if (!e_comp) return ECORE_CALLBACK_RENEW;
ec = _e_comp_x_client_find_by_window(ev->win);
if (e_comp_ignore_win_find(ev->win) ||
(ec && (ec->ignored || ec->override)) ||
@ -2210,6 +2211,7 @@ _e_comp_x_mapping_change(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_E
const Eina_List *l;
E_Client *ec;
if (!e_comp) return ECORE_CALLBACK_RENEW;
if (_e_comp_x_mapping_change_disabled) return ECORE_CALLBACK_RENEW;
e_comp_canvas_keys_ungrab();
EINA_LIST_FOREACH(e_comp->clients, l, ec)
@ -2241,6 +2243,7 @@ _e_comp_x_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_M
{
E_Client *ec;
if (!e_comp) return ECORE_CALLBACK_RENEW;
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return ECORE_CALLBACK_RENEW;
ec = _e_comp_x_client_find_by_window(ev->win);
if (!ec) return ECORE_CALLBACK_RENEW;
@ -2269,6 +2272,7 @@ _e_comp_x_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_
{
E_Client *ec;
if (!e_comp) return ECORE_CALLBACK_RENEW;
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return ECORE_CALLBACK_RENEW;
if ((ev->mode == ECORE_X_EVENT_MODE_UNGRAB) &&
(ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR))
@ -2292,6 +2296,7 @@ _e_comp_x_mouse_wheel(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_
E_Client *ec;
E_Binding_Event_Wheel ev2;
if (!e_comp) return ECORE_CALLBACK_RENEW;
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return ECORE_CALLBACK_RENEW;
//if (action_input_win)
//ec = action_border;
@ -2315,6 +2320,7 @@ _e_comp_x_mouse_up(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_But
E_Client *ec;
E_Binding_Event_Mouse_Button ev2;
if (!e_comp) return ECORE_CALLBACK_RENEW;
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return ECORE_CALLBACK_RENEW;
//if (action_input_win)
//ec = action_border;
@ -2343,6 +2349,7 @@ _e_comp_x_mouse_down(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_B
E_Client *ec;
E_Binding_Event_Mouse_Button ev2;
if (!e_comp) return ECORE_CALLBACK_RENEW;
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return ECORE_CALLBACK_RENEW;
if (e_client_action_get()) return ECORE_CALLBACK_RENEW; //block extra mouse buttons during action
//if (action_input_win)
@ -2365,6 +2372,7 @@ _e_comp_x_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_M
{
E_Client *ec;
if (!e_comp) return ECORE_CALLBACK_RENEW;
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return ECORE_CALLBACK_RENEW;
ec = e_client_action_get();
if (!ec)