Check event handlers are valid before trying to delete them.

Use PATH_MAX.
Fix formatting/whitespace.



SVN revision: 44990
This commit is contained in:
Christopher Michael 2010-01-08 20:17:07 +00:00
parent 33fdfb9322
commit 8dbdeb73da
7 changed files with 64 additions and 59 deletions

View File

@ -699,7 +699,7 @@ _e_desklock_cb_exit(void *data, int type, void *event)
/* security - null out passwd string once we are done with it */ /* security - null out passwd string once we are done with it */
_e_desklock_null(); _e_desklock_null();
} }
ecore_event_handler_del(_e_desklock_exit_handler); if (_e_desklock_exit_handler) ecore_event_handler_del(_e_desklock_exit_handler);
_e_desklock_exit_handler = NULL; _e_desklock_exit_handler = NULL;
} }
return 1; return 1;

View File

@ -1123,8 +1123,10 @@ _e_entry_smart_del(Evas_Object *object)
#ifdef HAVE_ECORE_IMF #ifdef HAVE_ECORE_IMF
if (sd->imf_context) if (sd->imf_context)
{ {
ecore_event_handler_del(sd->imf_ee_commit_handler); if (sd->imf_ee_commit_handler)
ecore_event_handler_del(sd->imf_ee_delete_handler); ecore_event_handler_del(sd->imf_ee_commit_handler);
if (sd->imf_ee_delete_handler)
ecore_event_handler_del(sd->imf_ee_delete_handler);
ecore_imf_context_del(sd->imf_context); ecore_imf_context_del(sd->imf_context);
} }
#endif #endif
@ -1139,8 +1141,9 @@ _e_entry_smart_del(Evas_Object *object)
_e_entry_mouse_up_cb); _e_entry_mouse_up_cb);
evas_object_event_callback_del(object, EVAS_CALLBACK_MOUSE_MOVE, evas_object_event_callback_del(object, EVAS_CALLBACK_MOUSE_MOVE,
_e_entry_mouse_move_cb); _e_entry_mouse_move_cb);
ecore_event_handler_del(sd->selection_handler); if (sd->selection_handler)
ecore_event_handler_del(sd->selection_handler);
evas_object_del(sd->editable_object); evas_object_del(sd->editable_object);
evas_object_del(sd->entry_object); evas_object_del(sd->entry_object);
free(sd); free(sd);

View File

@ -37,7 +37,7 @@ e_init_shutdown(void)
if (version) eina_stringshare_del(version); if (version) eina_stringshare_del(version);
title = NULL; title = NULL;
version = NULL; version = NULL;
ecore_event_handler_del(exe_del_handler); if (exe_del_handler) ecore_event_handler_del(exe_del_handler);
exe_del_handler = NULL; exe_del_handler = NULL;
return 1; return 1;
} }

View File

@ -315,7 +315,8 @@ e_init_init(void)
EAPI int EAPI int
e_init_shutdown(void) e_init_shutdown(void)
{ {
ecore_event_handler_del(_e_init_configure_handler); if (_e_init_configure_handler)
ecore_event_handler_del(_e_init_configure_handler);
_e_init_configure_handler = NULL; _e_init_configure_handler = NULL;
e_init_hide(); e_init_hide();
return 1; return 1;

View File

@ -8,10 +8,9 @@
typedef struct _E_Remember_List E_Remember_List; typedef struct _E_Remember_List E_Remember_List;
struct _E_Remember_List struct _E_Remember_List
{ {
Eina_List *list; Eina_List *list;
}; };
/* local subsystem functions */ /* local subsystem functions */

View File

@ -7,8 +7,8 @@ typedef struct _E_Thumb E_Thumb;
struct _E_Thumb struct _E_Thumb
{ {
int objid; int objid;
int w, h; int w, h;
const char *file; const char *file;
const char *key; const char *key;
char *sort_id; char *sort_id;
@ -56,7 +56,7 @@ e_thumb_shutdown(void)
{ {
_e_thumb_thumbnailers_kill_cancel(); _e_thumb_thumbnailers_kill_cancel();
_e_thumb_cb_kill(NULL); _e_thumb_cb_kill(NULL);
ecore_event_handler_del(_exe_del_handler); if (_exe_del_handler) ecore_event_handler_del(_exe_del_handler);
_exe_del_handler = NULL; _exe_del_handler = NULL;
_thumbnailers = eina_list_free(_thumbnailers); _thumbnailers = eina_list_free(_thumbnailers);
E_FREE_LIST(_thumbnailers_exe, ecore_exe_free); E_FREE_LIST(_thumbnailers_exe, ecore_exe_free);

View File

@ -3,36 +3,37 @@
*/ */
#include "e.h" #include "e.h"
EAPI E_Path *path_data = NULL; EAPI E_Path *path_data = NULL;
EAPI E_Path *path_images = NULL; EAPI E_Path *path_images = NULL;
EAPI E_Path *path_fonts = NULL; EAPI E_Path *path_fonts = NULL;
EAPI E_Path *path_themes = NULL; EAPI E_Path *path_themes = NULL;
EAPI E_Path *path_icons = NULL; EAPI E_Path *path_icons = NULL;
EAPI E_Path *path_modules = NULL; EAPI E_Path *path_modules = NULL;
EAPI E_Path *path_backgrounds = NULL; EAPI E_Path *path_backgrounds = NULL;
EAPI E_Path *path_messages = NULL; EAPI E_Path *path_messages = NULL;
EAPI int restart = 0; EAPI int restart = 0;
EAPI int good = 0; EAPI int good = 0;
EAPI int evil = 0; EAPI int evil = 0;
EAPI int starting = 1; EAPI int starting = 1;
EAPI int stopping = 0; EAPI int stopping = 0;
typedef struct _E_Util_Fake_Mouse_Up_Info E_Util_Fake_Mouse_Up_Info; typedef struct _E_Util_Fake_Mouse_Up_Info E_Util_Fake_Mouse_Up_Info;
typedef struct _E_Util_Image_Import_Settings E_Util_Image_Import_Settings; typedef struct _E_Util_Image_Import_Settings E_Util_Image_Import_Settings;
struct _E_Util_Fake_Mouse_Up_Info struct _E_Util_Fake_Mouse_Up_Info
{ {
Evas *evas; Evas *evas;
int button; int button;
}; };
struct _E_Util_Image_Import_Settings struct _E_Util_Image_Import_Settings
{ {
E_Dialog *dia; E_Dialog *dia;
struct { struct
void (*func)(void *data, const char *path, Eina_Bool ok, Eina_Bool external, int quality, E_Image_Import_Mode mode); {
void *data; void (*func)(void *data, const char *path, Eina_Bool ok, Eina_Bool external, int quality, E_Image_Import_Mode mode);
} cb; void *data;
} cb;
const char *path; const char *path;
int quality; int quality;
int external; int external;
@ -44,13 +45,15 @@ struct _E_Util_Image_Import_Handle
{ {
Ecore_Exe *exe; Ecore_Exe *exe;
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
struct { struct
void (*func)(void *data, Eina_Bool ok, const char *image_path, const char *edje_path); {
void *data; void (*func)(void *data, Eina_Bool ok, const char *image_path, const char *edje_path);
} cb; void *data;
struct { } cb;
const char *image, *edje, *temp; struct
} path; {
const char *image, *edje, *temp;
} path;
}; };
/* local subsystem functions */ /* local subsystem functions */
@ -122,8 +125,7 @@ e_util_zone_current_get(E_Manager *man)
EAPI int EAPI int
e_util_glob_match(const char *str, const char *glob) e_util_glob_match(const char *str, const char *glob)
{ {
if (!str || !glob) if ((!str) || (!glob)) return 0;
return 0;
if (glob[0] == 0) if (glob[0] == 0)
{ {
if (str[0] == 0) return 1; if (str[0] == 0) return 1;
@ -474,7 +476,7 @@ EAPI int
e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name) e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name)
{ {
const char *file; const char *file;
char buf[4096]; char buf[PATH_MAX];
if ((!name) || (!name[0])) return 0; if ((!name) || (!name[0])) return 0;
if (name[0]=='/' && ecore_file_exists(name)) if (name[0]=='/' && ecore_file_exists(name))
@ -495,9 +497,11 @@ e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name)
EAPI unsigned int EAPI unsigned int
e_util_icon_size_normalize(unsigned int desired) e_util_icon_size_normalize(unsigned int desired)
{ {
const unsigned int *itr, known_sizes[] = { const unsigned int *itr, known_sizes[] =
16, 22, 24, 32, 36, 48, 64, 72, 96, 128, 192, 256, -1 {
}; 16, 22, 24, 32, 36, 48, 64, 72, 96, 128, 192, 256, -1
};
for (itr = known_sizes; *itr > 0; itr++) for (itr = known_sizes; *itr > 0; itr++)
if (*itr >= desired) if (*itr >= desired)
return *itr; return *itr;
@ -683,7 +687,7 @@ e_util_filename_escape(const char *filename)
{ {
const char *p; const char *p;
char *q; char *q;
static char buf[4096]; static char buf[PATH_MAX];
if (!filename) return NULL; if (!filename) return NULL;
p = filename; p = filename;
@ -716,10 +720,10 @@ e_util_filename_escape(const char *filename)
EAPI int EAPI int
e_util_icon_save(Ecore_X_Icon *icon, const char *filename) e_util_icon_save(Ecore_X_Icon *icon, const char *filename)
{ {
Ecore_Evas *ee; Ecore_Evas *ee;
Evas *evas; Evas *evas;
Evas_Object *im; Evas_Object *im;
int ret; int ret;
ee = ecore_evas_buffer_new(icon->width, icon->height); ee = ecore_evas_buffer_new(icon->width, icon->height);
if (!ee) return 0; if (!ee) return 0;
@ -753,7 +757,7 @@ e_util_shell_env_path_eval(char *path)
* $HOME/bin/$HOSTNAME/blah -> /home/user/bin/localhost/blah * $HOME/bin/$HOSTNAME/blah -> /home/user/bin/localhost/blah
* etc. etc. * etc. etc.
*/ */
char buf[4096], *pd, *p, *v2, *s, *vp; char buf[PATH_MAX], *pd, *p, *v2, *s, *vp;
char *v = NULL; char *v = NULL;
char *v1 = NULL; char *v1 = NULL;
int esc = 0, invar = 0; int esc = 0, invar = 0;
@ -867,9 +871,7 @@ e_util_file_time_get(time_t ftime)
diff = ltime - ftime; diff = ltime - ftime;
buf[0] = 0; buf[0] = 0;
if (ftime > ltime) if (ftime > ltime)
{ snprintf(buf, sizeof(buf), _("In the Future"));
snprintf(buf, sizeof(buf), _("In the Future"));
}
else else
{ {
if (diff <= 60) if (diff <= 60)
@ -928,13 +930,13 @@ e_util_library_path_restore(void)
{ {
if (prev_ld_library_path) if (prev_ld_library_path)
{ {
e_util_env_set("LD_LIBRARY_PATH", prev_ld_library_path); e_util_env_set("LD_LIBRARY_PATH", prev_ld_library_path);
E_FREE(prev_ld_library_path); E_FREE(prev_ld_library_path);
} }
if (prev_path) if (prev_path)
{ {
e_util_env_set("PATH", prev_path); e_util_env_set("PATH", prev_path);
E_FREE(prev_path); E_FREE(prev_path);
} }
} }
@ -968,7 +970,6 @@ EAPI Evas_Object *
e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas) e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas)
{ {
if ((!desktop) || (!desktop->icon)) return NULL; if ((!desktop) || (!desktop->icon)) return NULL;
return e_util_icon_theme_icon_add(desktop->icon, size, evas); return e_util_icon_theme_icon_add(desktop->icon, size, evas);
} }
@ -1076,6 +1077,7 @@ static int
_win_auto_size_calc(int max, int min) _win_auto_size_calc(int max, int min)
{ {
const float *itr, scales[] = {0.25, 0.3, 0.5, 0.75, 0.8, 0.9, 0.95, -1}; const float *itr, scales[] = {0.25, 0.3, 0.5, 0.75, 0.8, 0.9, 0.95, -1};
for (itr = scales; *itr > 0; itr++) for (itr = scales; *itr > 0; itr++)
{ {
int value = *itr * max; int value = *itr * max;
@ -1505,6 +1507,7 @@ static void
_e_util_image_import_settings_do(void *data, E_Dialog *dia) _e_util_image_import_settings_do(void *data, E_Dialog *dia)
{ {
E_Util_Image_Import_Settings *ctxt = data; E_Util_Image_Import_Settings *ctxt = data;
ctxt->ok = EINA_TRUE; ctxt->ok = EINA_TRUE;
e_util_defer_object_del(E_OBJECT(dia)); e_util_defer_object_del(E_OBJECT(dia));
} }
@ -1515,9 +1518,8 @@ _e_util_image_import_settings_del(void *obj)
E_Dialog *dia = obj; E_Dialog *dia = obj;
E_Util_Image_Import_Settings *ctxt = dia->data; E_Util_Image_Import_Settings *ctxt = dia->data;
ctxt->cb.func ctxt->cb.func(ctxt->cb.data, ctxt->path,
(ctxt->cb.data, ctxt->path, ctxt->ok, ctxt->external, ctxt->quality, ctxt->mode);
ctxt->ok, ctxt->external, ctxt->quality, ctxt->mode);
eina_stringshare_del(ctxt->path); eina_stringshare_del(ctxt->path);
E_FREE(ctxt); E_FREE(ctxt);
@ -1549,7 +1551,7 @@ _e_util_image_import_handle_free(E_Util_Image_Import_Handle *handle)
eina_stringshare_del(handle->path.image); eina_stringshare_del(handle->path.image);
eina_stringshare_del(handle->path.edje); eina_stringshare_del(handle->path.edje);
eina_stringshare_del(handle->path.temp); eina_stringshare_del(handle->path.temp);
ecore_event_handler_del(handle->handler); if (handle->handler) ecore_event_handler_del(handle->handler);
E_FREE(handle); E_FREE(handle);
} }