enventor - don't be segfault even if the proto edc file is not exist
This commit is contained in:
parent
60bd54cf51
commit
3f86a03c96
|
@ -552,6 +552,8 @@ edit_obj_get(edit_data *ed)
|
||||||
void
|
void
|
||||||
edit_term(edit_data *ed)
|
edit_term(edit_data *ed)
|
||||||
{
|
{
|
||||||
|
if (!ed) return;
|
||||||
|
|
||||||
color_data *cd = ed->cd;
|
color_data *cd = ed->cd;
|
||||||
parser_data *pd = ed->pd;
|
parser_data *pd = ed->pd;
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,8 @@ view_init(Evas_Object *parent, const char *group, stats_data *sd,
|
||||||
void
|
void
|
||||||
view_term(view_data *vd)
|
view_term(view_data *vd)
|
||||||
{
|
{
|
||||||
|
if (!vd) return;
|
||||||
|
|
||||||
if (vd->group_name) eina_stringshare_del(vd->group_name);
|
if (vd->group_name) eina_stringshare_del(vd->group_name);
|
||||||
if (vd->part_name) eina_stringshare_del(vd->part_name);
|
if (vd->part_name) eina_stringshare_del(vd->part_name);
|
||||||
|
|
||||||
|
|
26
src/main.c
26
src/main.c
|
@ -117,17 +117,21 @@ edc_proto_setup(option_data *od)
|
||||||
{
|
{
|
||||||
Eina_Bool success = EINA_TRUE;
|
Eina_Bool success = EINA_TRUE;
|
||||||
|
|
||||||
if (!ecore_file_exists(option_edc_path_get(od)))
|
char buf[PATH_MAX];
|
||||||
|
snprintf(buf, sizeof(buf), "%s/data/.proto/proto.edc",
|
||||||
|
elm_app_data_dir_get());
|
||||||
|
|
||||||
|
if (!ecore_file_exists(option_edc_path_get(od)))
|
||||||
{
|
{
|
||||||
EINA_LOG_INFO("No working edc file exists. Copy a proto.edc");
|
EINA_LOG_INFO("No working edc file exists. Copy a proto.edc");
|
||||||
success = eina_file_copy("./data/.proto/proto.edc",
|
success = eina_file_copy(buf,
|
||||||
option_edc_path_get(od),
|
option_edc_path_get(od),
|
||||||
EINA_FILE_COPY_DATA, NULL, NULL);
|
EINA_FILE_COPY_DATA, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Cannot find proto.edc in ./data/.proto/");
|
EINA_LOG_ERR("Cannot find file! \"%s\"", buf);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +439,7 @@ menu_close_cb(void *data)
|
||||||
ad->menu_opened = EINA_FALSE;
|
ad->menu_opened = EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
init(app_data *ad, int argc, char **argv)
|
init(app_data *ad, int argc, char **argv)
|
||||||
{
|
{
|
||||||
/*To add a key event handler before evas, here initialize the ecore_event
|
/*To add a key event handler before evas, here initialize the ecore_event
|
||||||
|
@ -448,9 +452,9 @@ init(app_data *ad, int argc, char **argv)
|
||||||
elm_setup();
|
elm_setup();
|
||||||
config_data_set(ad, argc, argv);
|
config_data_set(ad, argc, argv);
|
||||||
|
|
||||||
if (!edje_cc_cmd_set(ad->od)) return;
|
if (!edje_cc_cmd_set(ad->od)) return EINA_FALSE;
|
||||||
if (!edc_proto_setup(ad->od)) return;
|
if (!edc_proto_setup(ad->od)) return EINA_FALSE;
|
||||||
if (!base_gui_construct(ad)) return;
|
if (!base_gui_construct(ad)) return EINA_FALSE;
|
||||||
|
|
||||||
statusbar_set(ad, ad->od);
|
statusbar_set(ad, ad->od);
|
||||||
edc_edit_set(ad, ad->sd, ad->od);
|
edc_edit_set(ad, ad->sd, ad->od);
|
||||||
|
@ -460,6 +464,8 @@ init(app_data *ad, int argc, char **argv)
|
||||||
//FIXME: update the edc path whenever file is changed.
|
//FIXME: update the edc path whenever file is changed.
|
||||||
eio_monitor_add(option_edc_path_get(ad->od));
|
eio_monitor_add(option_edc_path_get(ad->od));
|
||||||
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, edc_changed_cb, ad);
|
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, edc_changed_cb, ad);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -481,7 +487,11 @@ main(int argc, char **argv)
|
||||||
app_data ad;
|
app_data ad;
|
||||||
memset(&ad, 0x00, sizeof(app_data));
|
memset(&ad, 0x00, sizeof(app_data));
|
||||||
|
|
||||||
init(&ad, argc, argv);
|
if (!init(&ad, argc, argv))
|
||||||
|
{
|
||||||
|
term(&ad);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
elm_run();
|
elm_run();
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,8 @@ stats_obj_get(stats_data *sd)
|
||||||
void
|
void
|
||||||
stats_term(stats_data *sd)
|
stats_term(stats_data *sd)
|
||||||
{
|
{
|
||||||
|
if (!sd) return;
|
||||||
|
|
||||||
if (sd->info_msg_timer) ecore_timer_del(sd->info_msg_timer);
|
if (sd->info_msg_timer) ecore_timer_del(sd->info_msg_timer);
|
||||||
free(sd);
|
free(sd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue