This list is best suited as a local object
Signed-off-by: David Kahurani k.kahurani@gmail.com
From: David Kahurani k.kahurani@gmail.com
Signed-off-by: David Kahurani k.kahurani@gmail.com --- dlls/gdiplus/gdiplus_private.h | 1 - dlls/gdiplus/image.c | 1 - dlls/gdiplus/metafile.c | 41 +++++++++++++++++++--------------- 3 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index d247b973b3b..54ab68f690b 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -458,7 +458,6 @@ struct GpMetafile{ REAL page_scale; GpRegion *base_clip; /* clip region in device space for all metafile output */ GpRegion *clip; /* clip region within the metafile */ - struct list containers; struct emfplus_object objtable[EmfPlusObjectTableSize]; };
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index eaf01cab65b..7fbc499430d 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -1415,7 +1415,6 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage) result->unit = metafile->unit; result->metafile_type = metafile->metafile_type; result->hemf = CopyEnhMetaFileW(metafile->hemf, NULL); - list_init(&result->containers);
if (!result->hemf) { diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 6ccfc469c25..8c75b600773 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -2763,11 +2763,25 @@ static GpStatus metafile_set_clip_region(GpMetafile *metafile, GpRegion *region, return METAFILE_PlaybackUpdateClip(metafile); }
+struct data +{ + void *callback_data; + struct list containers; +}data; + +struct enum_metafile_data +{ + EnumerateMetafileProc callback; + struct data *data; + GpMetafile *metafile; +}; + GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE *data) { GpStatus stat; GpMetafile *real_metafile = (GpMetafile*)metafile; + struct list containers = ((struct data*)data)->containers;
TRACE("(%p,%x,%x,%d,%p)\n", metafile, recordType, flags, dataSize, data);
@@ -3069,7 +3083,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, cont->world_transform = *metafile->world_transform; cont->page_unit = metafile->page_unit; cont->page_scale = metafile->page_scale; - list_add_head(&real_metafile->containers, &cont->entry); + list_add_head(&containers, &cont->entry);
unit = record->Header.Flags & 0xff;
@@ -3129,7 +3143,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, cont->world_transform = *metafile->world_transform; cont->page_unit = metafile->page_unit; cont->page_scale = metafile->page_scale; - list_add_head(&real_metafile->containers, &cont->entry); + list_add_head(&containers, &cont->entry);
break; } @@ -3146,7 +3160,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, else type = SAVE_GRAPHICS;
- LIST_FOR_EACH_ENTRY(cont, &real_metafile->containers, container, entry) + LIST_FOR_EACH_ENTRY(cont, &containers, container, entry) { if (cont->id == record->StackIndex && cont->type == type) { @@ -3160,7 +3174,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, container* cont2;
/* pop any newer items on the stack */ - while ((cont2 = LIST_ENTRY(list_head(&real_metafile->containers), container, entry)) != cont) + while ((cont2 = LIST_ENTRY(list_head(&containers), container, entry)) != cont) { list_remove(&cont2->entry); GdipDeleteRegion(cont2->clip); @@ -3757,13 +3771,6 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, return Ok; }
-struct enum_metafile_data -{ - EnumerateMetafileProc callback; - void *callback_data; - GpMetafile *metafile; -}; - static int CALLBACK enum_metafile_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, int nObj, LPARAM lpData) { @@ -3793,7 +3800,7 @@ static int CALLBACK enum_metafile_proc(HDC hDC, HANDLETABLE *lpHTable, const ENH pStr = NULL;
ret = data->callback(record->Type, record->Flags, record->DataSize, - pStr, data->callback_data); + pStr, data->data->callback_data);
if (!ret) return 0; @@ -3811,7 +3818,7 @@ static int CALLBACK enum_metafile_proc(HDC hDC, HANDLETABLE *lpHTable, const ENH pStr = NULL;
return data->callback(lpEMFR->iType, 0, lpEMFR->nSize-8, - pStr, data->callback_data); + pStr, data->data->callback_data); }
GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics, @@ -3844,7 +3851,7 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics, debugstr_pointf(&destPoints[2]));
data.callback = callback; - data.callback_data = callbackData; + data.data->callback_data = callbackData; data.metafile = real_metafile;
real_metafile->playback_graphics = graphics; @@ -3939,9 +3946,9 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics, GdipDeleteRegion(real_metafile->clip); real_metafile->clip = NULL;
- while (list_head(&real_metafile->containers)) + while (list_head(&data.data->containers)) { - container* cont = LIST_ENTRY(list_head(&real_metafile->containers), container, entry); + container* cont = LIST_ENTRY(list_head(&data.data->containers), container, entry); list_remove(&cont->entry); GdipDeleteRegion(cont->clip); free(cont); @@ -4268,7 +4275,6 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete, (*metafile)->printer_display = !(header.EmfPlusFlags & (1u << 31)); (*metafile)->logical_dpix = header.LogicalDpiX; (*metafile)->logical_dpiy = header.LogicalDpiY; - list_init(&(*metafile)->containers);
TRACE("<-- %p\n", *metafile);
@@ -4537,7 +4543,6 @@ GpStatus WINGDIPAPI GdipRecordMetafileFileName(GDIPCONST WCHAR* fileName, (*metafile)->printer_display = (GetDeviceCaps(record_dc, TECHNOLOGY) == DT_RASPRINTER); (*metafile)->logical_dpix = (REAL)GetDeviceCaps(record_dc, LOGPIXELSX); (*metafile)->logical_dpiy = (REAL)GetDeviceCaps(record_dc, LOGPIXELSY); - list_init(&(*metafile)->containers);
if (!pFrameRect) {
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=146050
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: gdiplus:metafile crashed (c0000005)
=== debian11b (64 bit WoW report) ===
Report validation errors: gdiplus:metafile crashed (c0000005)
This merge request was closed by David Kahurani.
Interesting. I don't the failures locally but I guess the test machines are the overlords here.
Esme Povirk (@madewokherd) commented about dlls/gdiplus/metafile.c:
- struct list containers;
+}data;
+struct enum_metafile_data +{
- EnumerateMetafileProc callback;
- struct data *data;
- GpMetafile *metafile;
+};
GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE *data) { GpStatus stat; GpMetafile *real_metafile = (GpMetafile*)metafile;
- struct list containers = ((struct data*)data)->containers;
The data passed into GdipPlayMetafileRecord is from the EMF file. It's not the callback data from the enumeration call.