After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 537683 - crash on paste due to gdiplus backend
crash on paste due to gdiplus backend
Status: RESOLVED OBSOLETE
Product: gdk-pixbuf
Classification: Platform
Component: GDI loader
git master
Other Windows
: Normal critical
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2008-06-10 21:15 UTC by Hans Breuer
Modified: 2018-05-22 13:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
broken loading via gdip-jpeg (113.31 KB, image/png)
2008-06-10 21:52 UTC, Hans Breuer
Details

Description Hans Breuer 2008-06-10 21:15:33 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
Comment 1 Dominic Lachowicz 2008-06-10 21:34:13 UTC
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.
Comment 2 Hans Breuer 2008-06-10 21:52:14 UTC
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.
Comment 3 Tor Lillqvist 2008-06-11 07:03:44 UTC
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.
Comment 4 JesseStone 2010-05-29 21:17:57 UTC
// 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;
}
Comment 5 Tor Lillqvist 2010-06-01 07:28:47 UTC
JesseStone, what are you trying to say?
Comment 6 JesseStone 2010-06-01 08:27:06 UTC
in XP windows the GDIPlus.dll have some bug~ need hoxfix
Comment 7 JesseStone 2010-06-01 08:29:04 UTC
if you using VC to build i can send my whole project for u,
its more easy debug~
Comment 8 GNOME Infrastructure Team 2018-05-22 13:07:41 UTC
-- 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.