From 25a09eb9bf2d993228a3d98d1dd271f55efb2358 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 8 Jan 2009 03:04:34 -0500 Subject: [PATCH] Don't use FcCharSetCopy in FcCharSetMerge The Copy function is actually a ref, not real copy. --- doc/fccharset.fncs | 2 +- src/fccharset.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/fccharset.fncs b/doc/fccharset.fncs index 93e1f5c..0dd7d1a 100644 --- a/doc/fccharset.fncs +++ b/doc/fccharset.fncs @@ -104,7 +104,7 @@ Returns a set including only those chars found in a but n @TYPE2@ const FcCharSet * @ARG2@ b @PURPOSE@ Merge charsets @DESC@ -If a is NULL, returns a copy of b. +If a is NULL, returns a newly-created copy of b. If a is an FcCharSet object owned by fontconfig that cannot be modified, it returns the union of a and b in a newly-created FcCharSet object. diff --git a/src/fccharset.c b/src/fccharset.c index 1891f08..2daa39d 100644 --- a/src/fccharset.c +++ b/src/fccharset.c @@ -459,14 +459,15 @@ FcCharSetMerge (FcCharSet *a, const FcCharSet *b) FcCharSetIter ai, bi; if (a == NULL) { - return FcCharSetCopy ((FcCharSet *) b); + fcs = a = FcCharSetCreate (); } else if (a->ref == FC_REF_CONSTANT) { fcs = FcCharSetCreate (); - if (fcs == NULL) - return NULL; } else fcs = a; + if (fcs == NULL) + return NULL; + FcCharSetIterStart (a, &ai); FcCharSetIterStart (b, &bi); while (ai.leaf || bi.leaf) -- 2.39.2