GNOME Bugzilla – Bug 537683
crash on paste due to gdiplus backend
Last modified: 2018-05-22 13:07:41 UTC
the new gdiplus-based backend crashes the GIMP when doing "paste as new". Also I have trouble with importing bmp or jpeg through gdiplus (my test application is Dia). It may have something to do with my msvc-build of gtk+, but all the functionality works fine when based on the "non-native" importers. Callstack follows. OLE32! 774d6136() [...] GDIPLUS! 4ebfa9bc() gdip_bitmap_to_pixbuf(_GpBitmap * 0x017a3878) line 682 + 22 bytes stop_load(_GpBitmap * 0x017a3878, _GdipContext * 0x01f40d80, _GError * * 0x0012eca0) line 729 + 9 bytes gdk_pixbuf__gdip_image_stop_load(void * 0x01f40d80, _GError * * 0x0012eca0) line 802 + 17 bytes gdk_pixbuf_loader_close(_GdkPixbufLoader * 0x0297bb30, _GError * * 0x00000000) line 724 + 26 bytes gtk_selection_data_get_pixbuf(_GtkSelectionData * 0x025709a0) line 1557 + 11 bytes gimp_clipboard_get_buffer(_Gimp * 0x0165d058) line 290 + 9 bytes edit_paste_as_new_cmd_callback(_GtkAction * 0x02460590, void * 0x017352f8) line 258 + 9 bytes
What exactly do you mean by "trouble"? Do those formats not work or are the images rendered incorrectly? How about the other formats supported by the gdi+ plugin (wmf, emf, gif)? Don't try PNG - that should still be handled by the non-native importer.
Created attachment 112512 [details] broken loading via gdip-jpeg Seen crashes and also once a partial decompression loading a jpeg. Of course I did not use PNG via gdiplus but only bmp, jpeg etc (I just did define INCLUDE_gdiplus with my build). Can not test currently with wmf/emf.
Doing a "Paste as new" in GIMP after doing a Select All and Copy in MSPaint doesn't crash for me, but it creates a black image... There definitely is a bug somewhere.
// GDItest.cpp : Defines the entry point for the console application. //follow function to test your GDI, and gdiplus.dll have hotfix from MS #include "stdafx.h" #include <windows.h> #define WINGDIPAPI __stdcall typedef struct _GpImage GpImage; typedef struct _GpBitmap GpBitmap; typedef struct _GpGraphics GpGraphics; struct _GdiplusStartupInput { unsigned int GdiplusVersion; void* DebugEventCallback; int SuppressBackgroundThread; int SuppressExternalCodecs; }; typedef struct _GdiplusStartupInput GdiplusStartupInput; enum _Status { Ok = 0, GenericError = 1, InvalidParameter = 2, OutOfMemory = 3, ObjectBusy = 4, InsufficientBuffer = 5, NotImplemented = 6, Win32Error = 7, WrongState = 8, Aborted = 9, FileNotFound = 10, ValueOverflow = 11, AccessDenied = 12, UnknownImageFormat = 13, FontFamilyNotFound = 14, FontStyleNotFound = 15, NotTrueTypeFont = 16, UnsupportedGdiplusVersion = 17, GdiplusNotInitialized = 18, PropertyNotFound = 19, PropertyNotSupported = 20, ProfileNotFound = 21 }; typedef enum _Status GpStatus; typedef void* gpointer; typedef void* gconstpointer; typedef unsigned long ARGB; typedef GpStatus (WINGDIPAPI* GdiplusStartupFunc) (gpointer, const gpointer, gpointer); typedef GpStatus (WINGDIPAPI* GdiplusShutdownFunc) (gpointer); typedef GpStatus (WINGDIPAPI* GdipCreateBitmapFromStreamFunc) (gpointer, GpBitmap**); typedef GpStatus (WINGDIPAPI* GdipCreateBitmapFromFileFunc) (WCHAR*, GpBitmap**); typedef GpStatus (WINGDIPAPI* GdipBitmapGetPixelFunc) (GpBitmap*, int x, int y, ARGB*); typedef GpStatus (WINGDIPAPI* GdipGetImageWidthFunc) (GpImage*, unsigned int*); typedef GpStatus (WINGDIPAPI* GdipGetImageHeightFunc) (GpImage*, unsigned int*); GdiplusStartupFunc GdiplusStartup; GdiplusShutdownFunc GdiplusShutdown; GdipCreateBitmapFromStreamFunc GdipCreateBitmapFromStream; GdipCreateBitmapFromFileFunc GdipCreateBitmapFromFile; GdipBitmapGetPixelFunc GdipBitmapGetPixel; GdipGetImageWidthFunc GdipGetImageWidth; GdipGetImageHeightFunc GdipGetImageHeight; HINSTANCE gdipluslib = NULL; int gdip_init(void) { GdiplusStartupInput input; long gdiplusToken = 0; if (!gdipluslib) gdipluslib = LoadLibrary ("gdiplus.dll"); else return TRUE; /* gdip_init() is idempotent */ GdiplusStartup = (GdiplusStartupFunc)GetProcAddress(gdipluslib, "GdiplusStartup"); GdiplusShutdown = (GdiplusShutdownFunc)GetProcAddress(gdipluslib, "GdiplusShutdown"); GdipBitmapGetPixel = (GdipBitmapGetPixelFunc)GetProcAddress(gdipluslib, "GdipBitmapGetPixel"); GdipCreateBitmapFromStream = (GdipCreateBitmapFromStreamFunc)GetProcAddress(gdipluslib, "GdipCreateBitmapFromStream"); GdipCreateBitmapFromFile = (GdipCreateBitmapFromFileFunc)GetProcAddress(gdipluslib, "GdipCreateBitmapFromFile"); input.GdiplusVersion = 1; input.DebugEventCallback = NULL; input.SuppressBackgroundThread = input.SuppressExternalCodecs = FALSE; return (GdiplusStartup (&gdiplusToken, &input, NULL) == 0 ? TRUE : FALSE); } int _tmain(int argc, _TCHAR* argv[]) { ARGB pixel; unsigned __int64 size64; //ULARGE_INTEGER size64; int status; FILE* gifp; HGLOBAL hg = NULL; IStream* stream = NULL; GpBitmap* bitmap = NULL; status = gdip_init(); status = fopen_s(&gifp,"rgb.gif","rb"); hg = GlobalAlloc (GPTR, 6427); fread(hg,1,6427,gifp); size64 = 6427; //size64.QuadPart = 6427; CreateStreamOnHGlobal (hg, FALSE, (LPSTREAM *)&stream); stream->SetSize(*(ULARGE_INTEGER*)&size64); status = GdipCreateBitmapFromStream (stream, &bitmap); //status = GdipCreateBitmapFromFile(L"rgb.gif", &bitmap); pixel = 0; status = GdipBitmapGetPixel (bitmap, 0, 0, &pixel); fclose(gifp); GdiplusShutdown(gdipluslib); status = FreeLibrary( gdipluslib ); return 0; }
JesseStone, what are you trying to say?
in XP windows the GDIPlus.dll have some bug~ need hoxfix
if you using VC to build i can send my whole project for u, its more easy debug~
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/15.