Avoid some memory leaks with incorrect themes.
SVN revision: 45018
This commit is contained in:
parent
1962919a63
commit
3ad157b9c8
78
src/iclass.c
78
src/iclass.c
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
* Copyright (C) 2004-2009 Kim Woelders
|
* Copyright (C) 2004-2010 Kim Woelders
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
@ -200,7 +200,6 @@ ImagestateCreate(const char *file)
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_DESTROY
|
|
||||||
static void
|
static void
|
||||||
ImagestateDestroy(ImageState * is)
|
ImagestateDestroy(ImageState * is)
|
||||||
{
|
{
|
||||||
|
@ -218,15 +217,19 @@ ImagestateDestroy(ImageState * is)
|
||||||
Efree(is);
|
Efree(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static ImageState *
|
||||||
FreeImageStateArray(ImageStateArray * isa)
|
ImagestateSet(ImageState ** isp, const char *name)
|
||||||
{
|
{
|
||||||
ImagestateDestroy(isa->normal);
|
ImageState *is;
|
||||||
ImagestateDestroy(isa->hilited);
|
|
||||||
ImagestateDestroy(isa->clicked);
|
is = ImagestateCreate(name);
|
||||||
ImagestateDestroy(isa->disabled);
|
|
||||||
|
if (*isp)
|
||||||
|
ImagestateDestroy(*isp);
|
||||||
|
*isp = is;
|
||||||
|
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_DESTROY */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ImagestateColorsAlloc(ImageState * is)
|
ImagestateColorsAlloc(ImageState * is)
|
||||||
|
@ -309,24 +312,20 @@ ImageclassCreate(const char *name)
|
||||||
ecore_list_prepend(iclass_list, ic);
|
ecore_list_prepend(iclass_list, ic);
|
||||||
|
|
||||||
ic->name = Estrdup(name);
|
ic->name = Estrdup(name);
|
||||||
ic->norm.normal = ic->norm.hilited = ic->norm.clicked = ic->norm.disabled =
|
|
||||||
NULL;
|
|
||||||
ic->active.normal = ic->active.hilited = ic->active.clicked =
|
|
||||||
ic->active.disabled = NULL;
|
|
||||||
ic->sticky.normal = ic->sticky.hilited = ic->sticky.clicked =
|
|
||||||
ic->sticky.disabled = NULL;
|
|
||||||
ic->sticky_active.normal = ic->sticky_active.hilited =
|
|
||||||
ic->sticky_active.clicked = ic->sticky_active.disabled = NULL;
|
|
||||||
ic->padding.left = 0;
|
|
||||||
ic->padding.right = 0;
|
|
||||||
ic->padding.top = 0;
|
|
||||||
ic->padding.bottom = 0;
|
|
||||||
ic->ref_count = 0;
|
|
||||||
|
|
||||||
return ic;
|
return ic;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_DESTROY
|
#if ENABLE_DESTROY
|
||||||
|
static void
|
||||||
|
FreeImageStateArray(ImageStateArray * isa)
|
||||||
|
{
|
||||||
|
ImagestateDestroy(isa->normal);
|
||||||
|
ImagestateDestroy(isa->hilited);
|
||||||
|
ImagestateDestroy(isa->clicked);
|
||||||
|
ImagestateDestroy(isa->disabled);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ImageclassDestroy(ImageClass * ic)
|
ImageclassDestroy(ImageClass * ic)
|
||||||
{
|
{
|
||||||
|
@ -506,52 +505,52 @@ ImageclassConfigLoad(FILE * fs)
|
||||||
case CONFIG_DESKTOP:
|
case CONFIG_DESKTOP:
|
||||||
/* don't ask... --mandrake */
|
/* don't ask... --mandrake */
|
||||||
case ICLASS_NORMAL:
|
case ICLASS_NORMAL:
|
||||||
ic->norm.normal = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->norm.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_CLICKED:
|
case ICLASS_CLICKED:
|
||||||
ic->norm.clicked = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->norm.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_HILITED:
|
case ICLASS_HILITED:
|
||||||
ic->norm.hilited = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->norm.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_DISABLED:
|
case ICLASS_DISABLED:
|
||||||
ic->norm.disabled = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->norm.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_NORMAL:
|
case ICLASS_STICKY_NORMAL:
|
||||||
ic->sticky.normal = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_CLICKED:
|
case ICLASS_STICKY_CLICKED:
|
||||||
ic->sticky.clicked = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_HILITED:
|
case ICLASS_STICKY_HILITED:
|
||||||
ic->sticky.hilited = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_DISABLED:
|
case ICLASS_STICKY_DISABLED:
|
||||||
ic->sticky.disabled = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_NORMAL:
|
case ICLASS_ACTIVE_NORMAL:
|
||||||
ic->active.normal = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->active.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_CLICKED:
|
case ICLASS_ACTIVE_CLICKED:
|
||||||
ic->active.clicked = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->active.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_HILITED:
|
case ICLASS_ACTIVE_HILITED:
|
||||||
ic->active.hilited = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->active.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_DISABLED:
|
case ICLASS_ACTIVE_DISABLED:
|
||||||
ic->active.disabled = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->active.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_NORMAL:
|
case ICLASS_STICKY_ACTIVE_NORMAL:
|
||||||
ic->sticky_active.normal = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky_active.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_CLICKED:
|
case ICLASS_STICKY_ACTIVE_CLICKED:
|
||||||
ic->sticky_active.clicked = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky_active.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_HILITED:
|
case ICLASS_STICKY_ACTIVE_HILITED:
|
||||||
ic->sticky_active.hilited = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky_active.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_DISABLED:
|
case ICLASS_STICKY_ACTIVE_DISABLED:
|
||||||
ic->sticky_active.disabled = is = ImagestateCreate(s2);
|
is = ImagestateSet(&ic->sticky_active.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +561,8 @@ ImageclassConfigLoad(FILE * fs)
|
||||||
switch (i1)
|
switch (i1)
|
||||||
{
|
{
|
||||||
case ICLASS_LRTB:
|
case ICLASS_LRTB:
|
||||||
is->border = EMALLOC(EImageBorder, 1);
|
if (!is->border)
|
||||||
|
is->border = EMALLOC(EImageBorder, 1);
|
||||||
l = r = t = b = 0;
|
l = r = t = b = 0;
|
||||||
sscanf(p2, "%i %i %i %i", &l, &r, &t, &b);
|
sscanf(p2, "%i %i %i %i", &l, &r, &t, &b);
|
||||||
is->border->left = l;
|
is->border->left = l;
|
||||||
|
|
52
src/tclass.c
52
src/tclass.c
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
* Copyright (C) 2004-2009 Kim Woelders
|
* Copyright (C) 2004-2010 Kim Woelders
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
@ -70,9 +70,8 @@ TextstateCreate(const char *font)
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_DESTROY
|
|
||||||
static void
|
static void
|
||||||
TextStateDestroy(TextState * ts)
|
TextstateDestroy(TextState * ts)
|
||||||
{
|
{
|
||||||
if (!ts)
|
if (!ts)
|
||||||
return;
|
return;
|
||||||
|
@ -83,7 +82,20 @@ TextStateDestroy(TextState * ts)
|
||||||
|
|
||||||
Efree(ts);
|
Efree(ts);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
static TextState *
|
||||||
|
TextstateSet(TextState ** tsp, const char *name)
|
||||||
|
{
|
||||||
|
TextState *ts;
|
||||||
|
|
||||||
|
ts = TextstateCreate(name);
|
||||||
|
|
||||||
|
if (*tsp)
|
||||||
|
TextstateDestroy(*tsp);
|
||||||
|
*tsp = ts;
|
||||||
|
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
static TextClass *
|
static TextClass *
|
||||||
TextclassCreate(const char *name)
|
TextclassCreate(const char *name)
|
||||||
|
@ -263,52 +275,52 @@ TextclassConfigLoad(FILE * fs)
|
||||||
continue;
|
continue;
|
||||||
case CONFIG_DESKTOP:
|
case CONFIG_DESKTOP:
|
||||||
case ICLASS_NORMAL:
|
case ICLASS_NORMAL:
|
||||||
tc->norm.normal = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->norm.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_CLICKED:
|
case ICLASS_CLICKED:
|
||||||
tc->norm.clicked = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->norm.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_HILITED:
|
case ICLASS_HILITED:
|
||||||
tc->norm.hilited = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->norm.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_DISABLED:
|
case ICLASS_DISABLED:
|
||||||
tc->norm.disabled = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->norm.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_NORMAL:
|
case ICLASS_STICKY_NORMAL:
|
||||||
tc->sticky.normal = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_CLICKED:
|
case ICLASS_STICKY_CLICKED:
|
||||||
tc->sticky.clicked = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_HILITED:
|
case ICLASS_STICKY_HILITED:
|
||||||
tc->sticky.hilited = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_DISABLED:
|
case ICLASS_STICKY_DISABLED:
|
||||||
tc->sticky.disabled = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_NORMAL:
|
case ICLASS_ACTIVE_NORMAL:
|
||||||
tc->active.normal = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->active.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_CLICKED:
|
case ICLASS_ACTIVE_CLICKED:
|
||||||
tc->active.clicked = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->active.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_HILITED:
|
case ICLASS_ACTIVE_HILITED:
|
||||||
tc->active.hilited = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->active.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_ACTIVE_DISABLED:
|
case ICLASS_ACTIVE_DISABLED:
|
||||||
tc->active.disabled = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->active.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_NORMAL:
|
case ICLASS_STICKY_ACTIVE_NORMAL:
|
||||||
tc->sticky_active.normal = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky_active.normal, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_CLICKED:
|
case ICLASS_STICKY_ACTIVE_CLICKED:
|
||||||
tc->sticky_active.clicked = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky_active.clicked, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_HILITED:
|
case ICLASS_STICKY_ACTIVE_HILITED:
|
||||||
tc->sticky_active.hilited = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky_active.hilited, s2);
|
||||||
continue;
|
continue;
|
||||||
case ICLASS_STICKY_ACTIVE_DISABLED:
|
case ICLASS_STICKY_ACTIVE_DISABLED:
|
||||||
tc->sticky_active.disabled = ts = TextstateCreate(s2);
|
ts = TextstateSet(&tc->sticky_active.disabled, s2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue