On 24-01-19 12:12, Nikolay Sivov wrote:
On 1/24/19 1:59 PM, Sven Baars wrote:
Signed-off-by: Sven Baars sven.wine@gmail.com
This was added in 5694825ae3c3a581976716a62e1b2d1fb54e5674, but the corrected test shows this may not be correct. Maybe Vincent still knows why this was done?
dlls/gdiplus/font.c | 20 ++++---------------- dlls/gdiplus/tests/font.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 5e6aa5430f..cbe7859fe7 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -1576,7 +1576,6 @@ GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList( GpFontFamily* gpfamilies[], INT* numFound) { INT i; - GpStatus stat=Ok; TRACE("%p, %d, %p, %p\n", fontCollection, numSought, gpfamilies, numFound); @@ -1585,24 +1584,13 @@ GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList( memset(gpfamilies, 0, sizeof(*gpfamilies) * numSought); - for (i = 0; i < numSought && i < fontCollection->count && stat == Ok; i++) + for (i = 0; i < numSought && i < fontCollection->count; i++) { - stat = GdipCloneFontFamily(fontCollection->FontFamilies[i], &gpfamilies[i]); + gpfamilies[i] = fontCollection->FontFamilies[i]; } + *numFound = i; - if (stat == Ok) - *numFound = i; - else - { - int numToFree=i; - for (i=0; i<numToFree; i++) - { - GdipDeleteFontFamily(gpfamilies[i]); - gpfamilies[i] = NULL; - } - }
- return stat; + return Ok; }
Last time I looked at this one, I remember that it needed to be reference-counted.
Test path for that is to compare instance returned from GdipGetFamily() to what you get from collection.
Apparently the font families are indeed not cloned for the fonts themselves:
https://testbot.winehq.org/JobDetails.pl?Key=46590
but using GdipDeleteFontFamily on the font family that is returned from GdipGetFontCollectionFamilyList crashes on Windows as can be seen here
https://testbot.winehq.org/JobDetails.pl?Key=46598
whereas this succeeds (removing only the topmost test)
https://testbot.winehq.org/JobDetails.pl?Key=46594
so I don't think it is refcounted there (or the refcount is not increased). At least I would assume that GdipDeleteFontFamily reduced the refcount if it worked like that. That or GdipNewPrivateFontCollection is just bugged since deleting the font family does work in the other tests...