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 128410 - GDI object leak in reorderable GtkTreeView
GDI object leak in reorderable GtkTreeView
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.2.x
Other Windows
: Normal normal
: ---
Assigned To: Tor Lillqvist
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-12-03 01:20 UTC by Tim Evans
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
simple test case demostrating this bug (861 bytes, text/plain)
2003-12-03 01:22 UTC, Tim Evans
  Details
The bitmaps that are leaking (274 bytes, image/png)
2003-12-04 00:09 UTC, Tim Evans
  Details
patch against gtk+2.2.4 (gdk_pointer_grab) that fixes this bug (418 bytes, patch)
2003-12-04 01:17 UTC, Tim Evans
none Details | Review
Better patch (597 bytes, patch)
2003-12-04 21:44 UTC, Tor Lillqvist
none Details | Review

Description Tim Evans 2003-12-03 01:20:35 UTC
I will attach a small test program that demonstrates a GDI object leak in a
reorderable GtkTreeView when dragging rows.  On my system, the program
starts with 44 GDI objects (accoding to the task manager).  When I click on
a row and start dragging the number of GDI objects goes up every time
something is redrawn, rapidly reaching 60 and still climbing.  I can't
quite tell what redraw is causing this leak right now, but I will keep looking.
Comment 1 Tim Evans 2003-12-03 01:22:44 UTC
Created attachment 22035 [details]
simple test case demostrating this bug
Comment 2 Tim Evans 2003-12-03 04:22:40 UTC
I can now say exactly *when* (but not where or why) the leak occurs.  

Start by doing a few drags to initialize the permanent stuff, so that
only the real leaks appear.  Then drag the top row down slowly so that
the drop indicator line appears below the first row.  When that
indicator appears two GDI objects are leaked.  Then drag back up so
that the indicator line disappears.  At this point 1 more GDI object
is leaked.

This may not be the only place that leaks occur, but it is one place.
Comment 3 Tim Evans 2003-12-04 00:09:14 UTC
I found a very useful piece of code in this article:
http://msdn.microsoft.com/msdnmag/issues/03/01/GDILeaks/default.aspx

Using this "GdiUsage" program for Windows XP, I was able to find that
the leaked objects are the bitmaps used for the drag-and-drop mouse
pointers.  I will attach a screenshot of the bitmaps that are leaking.
Comment 4 Tim Evans 2003-12-04 00:09:55 UTC
Created attachment 22077 [details]
The bitmaps that are leaking
Comment 5 Tim Evans 2003-12-04 01:17:39 UTC
Created attachment 22079 [details] [review]
patch against gtk+2.2.4 (gdk_pointer_grab) that fixes this bug
Comment 6 Tor Lillqvist 2003-12-04 21:31:13 UTC
I don't think that is the correct fix. You are destroying the cursor 
pointed to by p_grab_cursor, and that is used later during the grab, 
in the WM_SETCURSOR handler. The pointer grab cursor is supposed to 
get destroyed in gdk_display_pointer_ungrab().

I think the real problem is that if gdk_pointer_grab is called 
multiple times without any call to _ungrab inbetween, the old grab 
cursor, if any, is leaked.
Comment 7 Tor Lillqvist 2003-12-04 21:44:23 UTC
Created attachment 22117 [details] [review]
Better patch
Comment 8 Tim Evans 2003-12-04 23:53:20 UTC
Yes, that looks better.  Thanks.
Comment 9 Tor Lillqvist 2003-12-07 06:58:16 UTC
Patch applied to HEAD and gtk-2-2.