ewwwww.. i forgot to free the font string....

and forgot to cleanup clip lists on objects when the evas gets deleteded and
all objectsin it get nuked!

woop! fix fix fix :)


SVN revision: 5185
This commit is contained in:
Carsten Haitzler 2001-08-17 00:05:12 +00:00
parent 55bba3ab5e
commit 4790ba40f1
8 changed files with 78 additions and 25 deletions

View File

@ -759,7 +759,8 @@ __evas_gl_image_alloc(char *file)
im = imlib_load_image(file);
if (!im) return NULL;
image = malloc(sizeof(Evas_GL_Image));
image->file = strdup(file);
image->file = malloc(strlen(file) + 1);
strcpy(image->file, file);
image->im = im;
prev_im = imlib_context_get_image();
imlib_context_set_image(im);
@ -1107,14 +1108,28 @@ __evas_gl_font_find(char *font)
for (i = 0; i < 3; i++)
{
sprintf(buf, "%s%s", font, ext[i]);
if (__evas_gl_is_file(buf)) return strdup(buf);
if (__evas_gl_is_file(buf))
{
char *f;
f = malloc(strlen(buf) + 1);
strcpy(f, buf);
return f;
}
}
for (j = 0; j < __evas_fpath_num; j++)
{
for (i = 0; i < 3; i++)
{
sprintf(buf, "%s/%s%s", __evas_fpath[j], font, ext[i]);
if (__evas_gl_is_file(buf)) return strdup(buf);
if (__evas_gl_is_file(buf))
{
char *f;
f = malloc(strlen(buf) + 1);
strcpy(f, buf);
return f;
}
}
}
return NULL;
@ -1138,7 +1153,8 @@ __evas_gl_font_load(char *font, int size)
__evas_have_tt_engine = 1;
}
fn = malloc(sizeof(Evas_GL_Font));
fn->font = strdup(font);
fn->font = malloc(strlen(font) + 1);
strcpy(fn->font, font);
fn->size = size;
fn->engine = __evas_tt_engine;
error = TT_Open_Face(fn->engine, file, &fn->face);
@ -1876,7 +1892,8 @@ __evas_gl_text_font_add_path(char *path)
if (!__evas_fpath) __evas_fpath = malloc(sizeof(char *));
else __evas_fpath = realloc(__evas_fpath,
(__evas_fpath_num * sizeof(char *)));
__evas_fpath[__evas_fpath_num - 1] = strdup(path);
__evas_fpath[__evas_fpath_num - 1] = malloc(strlen(path) + 1);
strcpy(__evas_fpath[__evas_fpath_num - 1], path);
}
void

View File

@ -67,7 +67,8 @@ evas_add_image_from_file(Evas e, char *file)
if (file)
{
oo->current.file = strdup(file);
oo->current.file = malloc(strlen(file) + 1);
strcpy(oo->current.file, file);
{
Imlib_Image im;
@ -144,7 +145,8 @@ evas_set_image_file(Evas e, Evas_Object o, char *file)
if (oo->current.file)
free(oo->current.file);
oo->previous.file = NULL;
oo->current.file = strdup(file);
oo->current.file = malloc(strlen(file) + 1);
strcpy(oo->current.file, file);
{
Imlib_Image im;

View File

@ -116,7 +116,8 @@ __evas_imlib_image_new_from_file(Display *disp, char *file)
image = imlib_load_image(file);
if (!image) return NULL;
im = malloc(sizeof(Evas_Imlib_Image));
im->file = strdup(file);
im->file = malloc(strlen(file) + 1);
strcpy(im->file, file);
im->image = image;
im->scaled.aa = 0;
im->scaled.w = 0;

View File

@ -26,7 +26,6 @@ evas_new_all(Display *display, Window parent_window,
Colormap colormap;
e = evas_new();
e->current.created_window = 1;
evas_set_output_method(e, render_method);
evas_set_output_colors(e, colors);
visual = evas_get_optimal_visual(e, display);
@ -43,6 +42,7 @@ evas_new_all(Display *display, Window parent_window,
visual,
CWColormap | CWBorderPixel | CWEventMask | CWBackPixmap,
&att);
e->current.created_window = window;
if (font_dir) evas_font_add_path(e, font_dir);
evas_set_output(e, display, window, visual, colormap);
evas_set_output_size(e, w, h);
@ -140,13 +140,12 @@ evas_free(Evas e)
if (!e) return;
if ((e->current.display) &&
(e->current.created_window) &&
(e->current.drawable))
(e->current.created_window))
{
XErrorHandler prev_handler;
prev_handler = XSetErrorHandler((XErrorHandler)_evas_x_err);
XDestroyWindow(e->current.display, e->current.drawable);
XDestroyWindow(e->current.display, e->current.created_window);
XSync(e->current.display, False);
XSetErrorHandler(prev_handler);
}
@ -159,6 +158,7 @@ evas_free(Evas e)
}
if (e->layers) evas_list_free(e->layers);
if (e->updates) imlib_updates_free(e->updates);
if (e->obscures) imlib_updates_free(e->obscures);
free(e);
}
@ -563,7 +563,8 @@ evas_put_data(Evas e, Evas_Object o, char *key, void *data)
}
}
d = malloc(sizeof(struct _Evas_Data));
d->key = strdup(key);
d->key = malloc(strlen(key) + 1);
strcpy(d->key, key);
d->data = data;
o->data = evas_list_prepend(o->data, d);
}

View File

@ -102,6 +102,7 @@ _evas_layer_free(Evas e, Evas_Layer layer)
o = l->data;
_evas_callback_call(e, o, CALLBACK_FREE, 0, 0, 0);
_evas_cleanup_clip(e, o);
if (e->mouse.object == o) e->mouse.object = NULL;
if (e->mouse.button_object == o) e->mouse.button_object = NULL;
_evas_remove_callbacks(e, o);
@ -696,7 +697,10 @@ evas_object_set_name(Evas e, Evas_Object o, char *name)
if (o->name) free(o->name);
o->name = NULL;
if (name)
o->name = strdup(name);
{
o->name = malloc(strlen(name) + 1);
strcpy(o->name, name);
}
}
char *

View File

@ -59,7 +59,8 @@ __evas_render_image_new_from_file(Display *disp, char *file)
fmt.type = PictTypeDirect;
format_color = XRenderFindFormat(disp, PictFormatType | PictFormatDepth, &fmt, 0);
im->file = strdup(file);
im->file = malloc(strlen(file) + 1);
strcpy(im->file, file);
im->references = 1;
im->disp = disp;
im->has_alpha = imlib_image_has_alpha();

View File

@ -18,6 +18,7 @@ _evas_free_text(Evas_Object o)
IF_OBJ(o, OBJECT_TEXT) return;
oo = o;
if (oo->current.text) free(oo->current.text);
if (oo->current.font) free(oo->current.font);
free(o);
}
@ -67,8 +68,10 @@ evas_add_text(Evas e, char *font, int size, char *text)
o->object_free = _evas_free_text;
o->object_renderer_data_free = _evas_free_text_renderer_data;
oo->current.text = strdup(text);
oo->current.font = strdup(font);
oo->current.text = malloc(strlen(text) + 1);
strcpy(oo->current.text, text);
oo->current.font = malloc(strlen(font) + 1);
strcpy(oo->current.font, font);
oo->current.size = size;
{
@ -829,9 +832,15 @@ evas_set_text(Evas e, Evas_Object o, char *text)
if (oo->current.text) free(oo->current.text);
oo->current.text = NULL;
if (text)
oo->current.text = strdup(text);
{
oo->current.text = malloc(strlen(text) + 1);
strcpy(oo->current.text, text);
}
else
oo->current.text = strdup("");
{
oo->current.text = malloc(strlen("") + 1);
strcpy(oo->current.text, "");
}
oo->previous.text = NULL;
{
switch (e->current.render_method)
@ -965,7 +974,8 @@ evas_set_font(Evas e, Evas_Object o, char *font, int size)
return;
_evas_free_text_renderer_data(e, o);
if (oo->current.font) free(oo->current.font);
oo->current.font = strdup(font);
oo->current.font = malloc(strlen(font) + 1);
strcpy(oo->current.font, font);
oo->previous.font = NULL;
oo->current.size = size;
{

View File

@ -141,7 +141,8 @@ __evas_x11_image_new_from_file(Display *disp, char *file)
return NULL;
}
im->disp = disp;
im->file = strdup(file);
im->file = malloc(strlen(file) + 1);
strcpy(im->file, file);
im->references = 1;
imlib_context_set_image(im->image);
im->w = imlib_image_get_width();
@ -573,14 +574,28 @@ __evas_x11_font_find(char *font)
for (i = 0; i < 3; i++)
{
sprintf(buf, "%s%s", font, ext[i]);
if (__evas_x11_is_file(buf)) return strdup(buf);
if (__evas_x11_is_file(buf))
{
char *f;
f = malloc(strlen(buf) + 1);
strcpy(f, buf);
return f;
}
}
for (j = 0; j < __evas_fpath_num; j++)
{
for (i = 0; i < 3; i++)
{
sprintf(buf, "%s/%s%s", __evas_fpath[j], font, ext[i]);
if (__evas_x11_is_file(buf)) return strdup(buf);
if (__evas_x11_is_file(buf))
{
char *f;
f = malloc(strlen(buf) + 1);
strcpy(f, buf);
return f;
}
}
}
return NULL;
@ -604,7 +619,8 @@ __evas_x11_font_load(char *font, int size)
__evas_have_tt_engine = 1;
}
fn = malloc(sizeof(Evas_X11_Font));
fn->font = strdup(font);
fn->font = malloc(strlen(font) + 1);
strcpy(fn->font, font);
fn->size = size;
fn->engine = __evas_tt_engine;
fn->mem_use = 0;
@ -877,7 +893,8 @@ __evas_x11_text_font_add_path(char *path)
if (!__evas_fpath) __evas_fpath = malloc(sizeof(char *));
else __evas_fpath = realloc(__evas_fpath,
(__evas_fpath_num * sizeof(char *)));
__evas_fpath[__evas_fpath_num - 1] = strdup(path);
__evas_fpath[__evas_fpath_num - 1] = malloc(strlen(path) + 1);
strcpy(__evas_fpath[__evas_fpath_num - 1], path);
}
void