From: Haoyang Chen chenhaoyang@kylinos.cn
--- dlls/gdiplus/graphics.c | 3 +++ dlls/gdiplus/tests/graphics.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 1a11cca1892..f7559201c59 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -6039,6 +6039,9 @@ GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string if(!graphics || !string || !font || !brush || !rect) return InvalidParameter;
+ if(graphics->busy) + return ObjectBusy; + if(has_gdi_dc(graphics)) { status = gdi_dc_acquire(graphics, &hdc); diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 29529463fa5..a7efec723ab 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -2336,7 +2336,7 @@ static void test_GdipDrawString(void) GpStringFormat *format; GpBrush *brush; LOGFONTA logfont; - HDC hdc = GetDC( hwnd ); + HDC hdc = GetDC( hwnd ), temp_hdc; static const WCHAR string[] = L"Test"; static const PointF positions[4] = {{0,0}, {1,1}, {2,2}, {3,3}}; GpMatrix *matrix; @@ -2390,6 +2390,16 @@ static void test_GdipDrawString(void) status = GdipDrawString(graphics, string, 4, fnt, &rect, format, brush); expect(Ok, status);
+ status = GdipGetDC(graphics, &temp_hdc); + expect(Ok, status); + ok(temp_hdc != NULL, "got NULL temp_hdc\n"); + + status = GdipDrawString(graphics, string, 4, fnt, &rect, format, brush); + expect(ObjectBusy, status); + + status = GdipReleaseDC(graphics, temp_hdc); + expect(Ok, status); + status = GdipCreateMatrix(&matrix); expect(Ok, status);