add bool return for e_exec_phony_del() to return deletion success

CID 1181927
This commit is contained in:
Mike Blumenkrantz 2016-11-02 10:11:02 -04:00
parent bfe02d2303
commit 4e08ad17e8
3 changed files with 16 additions and 12 deletions

View File

@ -586,15 +586,18 @@ _e_client_del(E_Client *ec)
if (ec->exe_inst) if (ec->exe_inst)
{ {
if (ec->exe_inst->phony && (eina_list_count(ec->exe_inst->clients) == 1)) if (ec->exe_inst->phony && (eina_list_count(ec->exe_inst->clients) == 1))
e_exec_phony_del(ec->exe_inst); {
if (e_exec_phony_del(ec->exe_inst))
ec->exe_inst = NULL;
}
else else
{ {
if (!ec->exe_inst->deleted) if (!ec->exe_inst->deleted)
ec->exe_inst->clients = eina_list_remove(ec->exe_inst->clients, ec); ec->exe_inst->clients = eina_list_remove(ec->exe_inst->clients, ec);
} }
if (!ec->exe_inst->deleted)
ec->exe_inst = NULL;
} }
if (ec->exe_inst && (!ec->exe_inst->deleted))
ec->exe_inst = NULL;
_e_client_mouse_action_end(ec); _e_client_mouse_action_end(ec);
if (action_client == ec) _e_client_action_finish(); if (action_client == ec) _e_client_action_finish();

View File

@ -65,7 +65,7 @@ static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static Evas_Object *_dialog_scrolltext_create(Evas *evas, char *title, Ecore_Exe_Event_Data_Line *lines); static Evas_Object *_dialog_scrolltext_create(Evas *evas, char *title, Ecore_Exe_Event_Data_Line *lines);
static void _dialog_save_cb(void *data, void *data2); static void _dialog_save_cb(void *data, void *data2);
static void _e_exec_instance_free(E_Exec_Instance *inst); static Eina_Bool _e_exec_instance_free(E_Exec_Instance *inst);
/* local subsystem globals */ /* local subsystem globals */
static Eina_List *e_exec_start_pending = NULL; static Eina_List *e_exec_start_pending = NULL;
@ -211,14 +211,14 @@ e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec,
return inst; return inst;
} }
E_API void E_API Eina_Bool
e_exec_phony_del(E_Exec_Instance *inst) e_exec_phony_del(E_Exec_Instance *inst)
{ {
if (!inst) return; if (!inst) return EINA_TRUE;
EINA_SAFETY_ON_TRUE_RETURN(!inst->phony); EINA_SAFETY_ON_TRUE_RETURN_VAL(!inst->phony, EINA_FALSE);
inst->ref--; inst->ref--;
_e_exe_instance_watchers_call(inst, E_EXEC_WATCH_STOPPED); _e_exe_instance_watchers_call(inst, E_EXEC_WATCH_STOPPED);
_e_exec_instance_free(inst); return _e_exec_instance_free(inst);
} }
E_API E_Exec_Instance * E_API E_Exec_Instance *
@ -587,13 +587,13 @@ _e_exec_cb_expire_timer(void *data)
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }
static void static Eina_Bool
_e_exec_instance_free(E_Exec_Instance *inst) _e_exec_instance_free(E_Exec_Instance *inst)
{ {
Eina_List *instances; Eina_List *instances;
E_Client *ec; E_Client *ec;
if (inst->ref) return; if (inst->ref) return EINA_FALSE;
E_FREE_LIST(inst->watchers, free); E_FREE_LIST(inst->watchers, free);
if (inst->key) if (inst->key)
{ {
@ -613,7 +613,7 @@ _e_exec_instance_free(E_Exec_Instance *inst)
inst->deleted = 1; inst->deleted = 1;
inst->ref++; inst->ref++;
ecore_event_add(E_EVENT_EXEC_DEL, inst, _e_exec_cb_exec_del_free, inst); ecore_event_add(E_EVENT_EXEC_DEL, inst, _e_exec_cb_exec_del_free, inst);
return; return EINA_FALSE;
} }
if (inst->desktop) if (inst->desktop)
e_exec_start_pending = eina_list_remove(e_exec_start_pending, e_exec_start_pending = eina_list_remove(e_exec_start_pending,
@ -629,6 +629,7 @@ _e_exec_instance_free(E_Exec_Instance *inst)
if (inst->exe) ecore_exe_data_set(inst->exe, NULL); if (inst->exe) ecore_exe_data_set(inst->exe, NULL);
} }
free(inst); free(inst);
return EINA_TRUE;
} }
/* /*

View File

@ -36,7 +36,7 @@ EINTERN int e_exec_shutdown(void);
E_API void e_exec_executor_set(E_Exec_Instance *(*func) (void *data, E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method), const void *data); E_API void e_exec_executor_set(E_Exec_Instance *(*func) (void *data, E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method), const void *data);
E_API E_Exec_Instance *e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method); E_API E_Exec_Instance *e_exec(E_Zone *zone, Efreet_Desktop *desktop, const char *exec, Eina_List *files, const char *launch_method);
E_API E_Exec_Instance *e_exec_phony(E_Client *ec); E_API E_Exec_Instance *e_exec_phony(E_Client *ec);
E_API void e_exec_phony_del(E_Exec_Instance *inst); E_API Eina_Bool e_exec_phony_del(E_Exec_Instance *inst);
E_API E_Exec_Instance *e_exec_startup_id_pid_instance_find(int id, pid_t pid); E_API E_Exec_Instance *e_exec_startup_id_pid_instance_find(int id, pid_t pid);
E_API Efreet_Desktop *e_exec_startup_id_pid_find(int startup_id, pid_t pid); E_API Efreet_Desktop *e_exec_startup_id_pid_find(int startup_id, pid_t pid);
E_API E_Exec_Instance *e_exec_startup_desktop_instance_find(Efreet_Desktop *desktop); E_API E_Exec_Instance *e_exec_startup_desktop_instance_find(Efreet_Desktop *desktop);