* BUG: Fix a memory leak when loading an image without transparency.


git-svn-id: svn://localhost/gambas/trunk@2938 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-05-08 15:36:10 +00:00
parent c61aa8d978
commit 3002ca88cf

View file

@ -124,6 +124,7 @@ __ERROR:
void gPicture::initialize()
{
fprintf(stderr, "gPicture::initialize: %p\n", this);
pic = 0;
mask = 0;
img = 0;
@ -217,10 +218,11 @@ gPicture::gPicture(GdkPixbuf *image, bool trans) : gShare()
GdkPixbuf *aimg;
aimg = gdk_pixbuf_add_alpha(img, FALSE, 0, 0, 0);
g_object_unref(G_OBJECT(img));
g_object_ref(G_OBJECT(aimg));
//g_object_ref(G_OBJECT(aimg));
img = aimg;
_transparent = false;
}
}
// The gPicture takes the GdkPixmap object. Do not unreference it after.
@ -238,6 +240,7 @@ gPicture::gPicture(GdkPixmap *pixmap) : gShare()
gPicture::~gPicture()
{
fprintf(stderr, "gPicture::~gPicture: %p\n", this);
clear();
}
@ -747,17 +750,6 @@ unsigned char *gPicture::data()
// }
/*void gPicture::fromMemory(char *addr,unsigned int len)
{
GdkPixbuf *img;
if (!pixbufFromMemory(&img,addr,len)) return;
if (image) g_object_unref(G_OBJECT(image));
image=img;
}*/
gPicture* gPicture::flip(bool mirror)
{
gPicture *ret;