[PATCH 0/1] MR10475: d2d1: Allow value NULL in d2d_effect_SetInput.
Wine-Bug: http://bugs.winehq.org/show_bug.cgi?id=59561 This patch avoids a crash at startup of the GTK3 build of VICE's C64 emulator x64sc.exe. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10475
From: Bernhard Übelacker <bernhardu@mailbox.org> Wine-Bug: http://bugs.winehq.org/show_bug.cgi?id=59561 --- dlls/d2d1/effect.c | 3 ++- dlls/d2d1/tests/d2d1.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index b66fe731523..286fae95e9c 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -2807,7 +2807,8 @@ static void STDMETHODCALLTYPE d2d_effect_SetInput(ID2D1Effect *iface, UINT32 ind if (index >= effect->input_count) return; - ID2D1Image_AddRef(input); + if (input) + ID2D1Image_AddRef(input); if (effect->inputs[index]) ID2D1Image_Release(effect->inputs[index]); effect->inputs[index] = input; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index cb6081695a0..c01c6eefde4 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -12081,6 +12081,13 @@ static void test_builtin_effect(BOOL d3d11) ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a); winetest_pop_context(); } + + /* Test setting NULL bitmap */ + image_a = (ID2D1Image *)0xdeadbeef; + ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)NULL, FALSE); + ID2D1Effect_GetInput(effect, 0, &image_a); + ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a); + ID2D1Bitmap_Release(bitmap); ID2D1Effect_Release(effect); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10475
This merge request was approved by Elizabeth Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10475
This merge request was approved by Nikolay Sivov. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10475
participants (4)
-
Bernhard Übelacker -
Bernhard Übelacker (@bernhardu) -
Elizabeth Figura (@zfigura) -
Nikolay Sivov (@nsivov)