GNOME Bugzilla – Bug 364514
gtk leaks GDI objects on the win32 classic look and feel
Last modified: 2006-10-24 01:38:01 UTC
gtk+ leaks GDI objects on minimize/restore among other behaviors under the classic windows theme on windows XP. Another user experiences the same behavior using win 2k. Steps: 1) Launch taskmanger 2) Configure task manager ti show GDI object count 3) launch gtk-demo.exe 4) minimize and restore the window repeatedly to watch th4e GDI object count slowly rise 5) play around with gtk demo and watch the count rise
Repeatable under Windows 2000. GDI object leaks accrue rapidly if you scroll the left hand pane of the demo app quite fast. Other sources of leaks include menus in GTK+ applications so the problem is quite fundamental. A GTK+ app can reach 10,000 GDI items leaked in well under 24 hours and fall apart, triggering a crash in Cairo. These debug lines may also be seen after too much leakage has occurred: (04:55:10) Gdk: gdkdrawable-win32.c:1313: LineTo failed: The operation completed successfully. (04:55:10) Gdk: gdkgc-win32.c:846: SaveDC failed: Not enough storage is available to process this command. (04:55:10) Gdk: gdkgc-win32.c:986: RestoreDC failed: The parameter is incorrect.
Sorry, I can't reproduce with gtk+ 2.10.6, pango 1.14.5, glib 2.12.4. No matter how much I minimize and restore gtk-demo, the GDI Object count stays at 66. Ditto if I scroll the left-hand pane up and down. Hmm, that is without using any gtk+ theme. If I use the ms-windows theme, I do see the GDI Object count increasing as you say. Thus, as a workaround, don't use the ms-windows theme.
This was related to the improvements in bug 340201. Some CreatePen() calls don't seem to be paired with DeleteObject() calls. I think that it's limited to draw_expander() in msw_style.c. It was a 1 line of code fix. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pens_9wha.asp FIXED in the CVS HEAD, 2-10, and 2-8 branches, since I'm not entirely sure what packagers are shipping these days.
*** Bug 364594 has been marked as a duplicate of this bug. ***