From c1ec0360e9ba65df1eec788f56c9d9fd7ac14b9b Mon Sep 17 00:00:00 2001 From: Faycal ElOuariachi Date: Mon, 12 Feb 2024 13:14:11 +0100 Subject: [PATCH] Fix the fetching of images in CF_DIB format in DisplayServerWindows::clipboard_get_image Fix the fetching of images from windows clipboard, if they're in CF_DIB format (e. g. by taking screenshots). Image::create_from_data was used with an instance of Image, but it's a static function, returning a new instance. --- platform/windows/display_server_windows.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index f0eec78b0db..e4550553243 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -760,8 +760,7 @@ Ref DisplayServerWindows::clipboard_get_image() const { pba.append(rgbquad->rgbReserved); } } - image.instantiate(); - image->create_from_data(info->biWidth, info->biHeight, false, Image::Format::FORMAT_RGBA8, pba); + image = Image::create_from_data(info->biWidth, info->biHeight, false, Image::Format::FORMAT_RGBA8, pba); GlobalUnlock(mem); }