Closed Bug 616994 Opened 15 years ago Closed 15 years ago

Image dragging (probably) causes big space leak

Categories

(Core :: Widget: Gtk, defect, P1)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla2.0b8
Tracking Status
blocking2.0 --- final+

People

(Reporter: jseward, Assigned: bzbarsky)

Details

Attachments

(1 file, 1 obsolete file)

Go to http://www.cad-comic.com/cad/20030614 Pick up image with mouse (all 6 panes are 1 big image), drag, release. Dragged image slides back to middle of original and disappears. (what's this functionality for? I never figured it out.) Repeat another 16 times. Memcheck leak check then reports as below. "possibly lost" means interior pointers to the blocks were found at process exit, but no pointers to the start thereof. So at a bare minimum, Fx should have freed them after each drag, but it didn't. If you drag N times you'll see N blocks leaked. 9,504,768 bytes in 17 blocks are possibly lost in loss record 5,559 of 5,559 at 0x4C27878: malloc (vg_replace_malloc.c:236) by 0x9373263: gdk_pixbuf_new (gdk-pixbuf.c:269) by 0x620B3BC: nsImageToPixbuf::ImgSurfaceToPixbuf(gfxImageSurface*, by 0x620B77C: nsImageToPixbuf::SurfaceToPixbuf(gfxASurface*, int, i by 0x621DA31: nsDragService::InvokeDragSession(nsIDOMNode*, nsISupp by 0x6226C87: nsBaseDragService::InvokeDragSessionWithImage(nsIDOMN by 0x5A63266: nsEventStateManager::DoDefaultDragStart(nsPresContext by 0x5A6A995: nsEventStateManager::GenerateDragGesture(nsPresContex by 0x5A6B0F4: nsEventStateManager::PreHandleEvent(nsPresContext*, n by 0x57F8C40: PresShell::HandleEventInternal(nsEvent*, nsIView*, ns by 0x57F9E50: PresShell::HandlePositionedEvent(nsIView*, nsIFrame*, by 0x57FD766: PresShell::HandleEvent(nsIView*, nsGUIEvent*, int, ns
16 bit display depth (a vnc server), I should probably add.
> (what's this functionality for? I never figured it out.) The sliding back is just standard "drop on a target that didn't accept it" feedback. If you drag to your desktop, or url bar, or another window/tab then we'll do a more useful drop. Looking at InvokeDragSession, this seems to be the relevant code: 257 if (!SetAlphaPixmap(surface, context, offsetX, offsetY, dragRect)) { 258 GdkPixbuf* dragPixbuf = 259 nsImageToPixbuf::SurfaceToPixbuf(surface, dragRect.width, dragRect.height); 260 if (dragPixbuf) 261 gtk_drag_set_icon_pixbuf(context, dragPixbuf, offsetX, offsetY); I believe that if clause should look like this: if (dragPixbuf) { gtk_drag_set_icon_pixbuf(context, dragPixbuf, offsetX, offsetY); g_object_unref(dragPixbuf); } (and that we should document the static nsImageToPixbuf methods as requiring a caller unref). Does making that change fix the leak?
Component: Graphics → Widget: Gtk
QA Contact: thebes → gtk
blocking2.0: --- → ?
Assignee: nobody → bzbarsky
Priority: -- → P1
Whiteboard: [need review]
OK, I verified that I can see the leak with |top| with a vanilla build, but not after applying this patch.
Attachment #495618 - Flags: review?(roc)
Verified here too. Is the first hunk in the patch relevant? It looks like it accidently crept in from somewhere else.
Attachment #495618 - Attachment is obsolete: true
Attachment #495618 - Flags: review?(roc)
Uh... yes. That hunk shouldn't be there!
Attachment #495644 - Flags: review?(roc)
Whiteboard: [need review] → [need landing]
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Whiteboard: [need landing]
Target Milestone: --- → mozilla2.0b8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: