editor: fix memory corruption when opening new win

Fixes issue when a file opened to a new window could not then
be focussed or re-loaded after the window is closed
This commit is contained in:
Andy Williams 2015-05-18 15:45:28 +01:00
parent 6e461200c6
commit d380f0f6d3
3 changed files with 10 additions and 4 deletions

View File

@ -451,7 +451,7 @@ _tb_new_create_cb(void *data,
fclose(fopen(path, "w"));
_edi_filepanel_reload();
edi_mainview_open_path(eina_stringshare_add(path));
edi_mainview_open_path(path);
evas_object_del(_edi_new_popup);
free((char*)path);

View File

@ -145,7 +145,7 @@ _edi_mainview_item_add(Edi_Path_Options *path, const char *mime, Elm_Object_Item
Edi_Mainview_Item *item;
item = malloc(sizeof(Edi_Mainview_Item));
item->path = path->path;
item->path = eina_stringshare_add(path->path);
item->editortype = path->type;
item->mimetype = mime;
item->tab = tab;
@ -425,6 +425,8 @@ edi_mainview_open_window_path(const char *path)
elm_naviframe_item_pop(nf);
elm_object_item_del(elm_toolbar_selected_item_get(tb));
_edi_mainview_items = eina_list_remove(_edi_mainview_items, it);
eina_stringshare_del(it->path);
free(it);
}
@ -445,6 +447,8 @@ edi_mainview_open_window(Edi_Path_Options *options)
elm_naviframe_item_pop(nf);
elm_object_item_del(elm_toolbar_selected_item_get(tb));
_edi_mainview_items = eina_list_remove(_edi_mainview_items, it);
eina_stringshare_del(it->path);
free(it);
}
@ -503,6 +507,7 @@ edi_mainview_close()
elm_object_item_del(elm_toolbar_selected_item_get(tb));
_edi_mainview_items = eina_list_remove(_edi_mainview_items, item);
eina_stringshare_del(item->path);
free(item);
}

View File

@ -20,7 +20,7 @@ edi_path_options_create(const char *input)
pos1 = strstr(path, ":");
if (pos1)
{
path = eina_stringshare_add_length(path, strlen(path) - strlen(pos1));
ret->path = eina_stringshare_add_length(path, strlen(path) - strlen(pos1));
pos1++;
pos2 = strstr(pos1, ":");
if (pos2)
@ -34,8 +34,9 @@ edi_path_options_create(const char *input)
line = atoi(pos1);
}
}
else
ret->path = eina_stringshare_add(path);
ret->path = path;
ret->line = line;
ret->character = col;