initialize texture to NULL if theres no textures. use g_memdup to copy it
This commit is contained in:
parent
4bceaaf165
commit
7bd747389d
1 changed files with 3 additions and 4 deletions
|
@ -141,6 +141,7 @@ Appearance *appearance_new(SurfaceType type, int numtex)
|
||||||
out->textures = numtex;
|
out->textures = numtex;
|
||||||
out->xftdraw = NULL;
|
out->xftdraw = NULL;
|
||||||
if (numtex) out->texture = g_new(Texture, numtex);
|
if (numtex) out->texture = g_new(Texture, numtex);
|
||||||
|
else out->texture = NULL;
|
||||||
out->pixmap = None;
|
out->pixmap = None;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -191,10 +192,8 @@ Appearance *appearance_copy(Appearance *orig)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
copy->textures = orig->textures;
|
copy->textures = orig->textures;
|
||||||
if (orig->textures) {
|
copy->texture = g_memdup(orig->texture,
|
||||||
copy->texture = malloc(orig->textures * sizeof(Texture));
|
orig->textures * sizeof(Texture));
|
||||||
memcpy(copy->texture, orig->texture, orig->textures * sizeof(Texture));
|
|
||||||
} else copy->texture = NULL;
|
|
||||||
copy->pixmap = None;
|
copy->pixmap = None;
|
||||||
copy->xftdraw = NULL;
|
copy->xftdraw = NULL;
|
||||||
return copy;
|
return copy;
|
||||||
|
|
Loading…
Reference in a new issue