From bfffadb030da1d112c7c64f8283080a1afe1fdd2 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sat, 19 Jun 2010 17:50:00 -0500 Subject: [PATCH 03/21] gdiplus: Return copies of fonts from GdipGetFontCollectionFamilyList. The caller is responsible for freeing these. --- dlls/gdiplus/font.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index f198863..2670e81 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -963,18 +963,33 @@ GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList( GpFontFamily* gpfamilies[], INT* numFound) { INT i; + GpStatus stat=Ok; TRACE("%p, %d, %p, %p\n", fontCollection, numSought, gpfamilies, numFound); if (!(fontCollection && gpfamilies && numFound)) return InvalidParameter; - for (i = 0; i < numSought && i < fontCollection->count; i++) + memset(gpfamilies, 0, sizeof(*gpfamilies) * numSought); + + for (i = 0; i < numSought && i < fontCollection->count && stat == Ok; i++) { - gpfamilies[i] = fontCollection->FontFamilies[i]; + stat = GdipCloneFontFamily(fontCollection->FontFamilies[i], &gpfamilies[i]); } - *numFound = i; - return Ok; + + if (stat == Ok) + *numFound = i; + else + { + int numToFree=i; + for (i=0; i