mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 616994. Don't leak the buffer we create for the drag image. r=roc, a=blocker
This commit is contained in:
parent
9d901fdd66
commit
5f268dee3c
@ -257,10 +257,12 @@ nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
|
||||
if (!SetAlphaPixmap(surface, context, offsetX, offsetY, dragRect)) {
|
||||
GdkPixbuf* dragPixbuf =
|
||||
nsImageToPixbuf::SurfaceToPixbuf(surface, dragRect.width, dragRect.height);
|
||||
if (dragPixbuf)
|
||||
if (dragPixbuf) {
|
||||
gtk_drag_set_icon_pixbuf(context, dragPixbuf, offsetX, offsetY);
|
||||
else
|
||||
g_object_unref(dragPixbuf);
|
||||
} else {
|
||||
needsFallbackIcon = PR_TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
needsFallbackIcon = PR_TRUE;
|
||||
|
@ -54,6 +54,10 @@ class nsIImageToPixbuf : public nsISupports {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NSIIMAGETOPIXBUF_IID)
|
||||
|
||||
/**
|
||||
* The return value, if not null, should be released as needed
|
||||
* by the caller using g_object_unref.
|
||||
*/
|
||||
NS_IMETHOD_(GdkPixbuf*) ConvertImageToPixbuf(imgIContainer* aImage) = 0;
|
||||
};
|
||||
|
||||
|
@ -51,6 +51,10 @@ class nsImageToPixbuf : public nsIImageToPixbuf {
|
||||
|
||||
// Friendlier version of ConvertImageToPixbuf for callers inside of
|
||||
// widget
|
||||
/**
|
||||
* The return value of all these, if not null, should be
|
||||
* released as needed by the caller using g_object_unref.
|
||||
*/
|
||||
static GdkPixbuf* ImageToPixbuf(imgIContainer * aImage);
|
||||
static GdkPixbuf* SurfaceToPixbuf(gfxASurface* aSurface,
|
||||
PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
Loading…
Reference in New Issue
Block a user