[Patch] memory leak in _wrap_pango_cairo_create_layout

Bug #981376 reported by YunQiang Su
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
PyGTK
Invalid
Medium
pygtk (Debian)
Fix Released
Unknown
pygtk (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

if didn't unref after pygobject_new.

while(1):
      a=pango_cairo.create_layout()

may cause, memory run out: python doesn't GC this memory.

The patch is:

Index: pygtk-2.24.0/pangocairo.override
===================================================================
--- pygtk-2.24.0.orig/pangocairo.override 2012-04-14 01:40:59.568703232
+0800
+++ pygtk-2.24.0/pangocairo.override 2012-04-14 01:41:05.792703324 +0800
@@ -119,10 +119,15 @@
 _wrap_pango_cairo_create_layout(PyGObject *self)
 {
     PangoLayout *ret;
+ PyObject *py_ret;

     ret = pango_cairo_create_layout(PycairoContext_GET(self));
     /* pygobject_new handles NULL checking */
- return pygobject_new((GObject *)ret);
+ py_ret = pygobject_new((GObject *) ret);
+ if (ret) {
+ g_object_unref(ret);
+ }
+ return py_ret;
 }

 static PyObject *

Tags: patch raring
Changed in pygtk:
importance: Unknown → Medium
status: Unknown → New
Changed in pygtk (Debian):
status: Unknown → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, setting to low though since gtk2 and pygtk are deprecated in favor of gtk3 and pygobject bindings

Changed in pygtk (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Aron Xu (happyaron)
tags: added: patch
Revision history for this message
Aron Xu (happyaron) wrote :

Hi Sebastien,

Could you have a look at this patch (if you can find some time)? We really want to have this patch land in Debian and Ubuntu because there are several new apps need this fix to avoid it eating up user's memory...

Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :

Can we fix this bug in Raring cycle?

tags: added: raring
Revision history for this message
Sebastien Bacher (seb128) wrote :

there is a patch from Owen Taylor on https://bugzilla.gnome.org/show_bug.cgi?id=660216 that fixes the issue and seems slightly more complete than the one listed there, I'm going to test and upload that

Changed in pygtk (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pygtk - 2.24.0-3ubuntu1

---------------
pygtk (2.24.0-3ubuntu1) raring; urgency=low

  * debian/patches/bugzilla_leak_fix.patch: uploaded patch from Owen Taylor
    to fix a leak issue in pango's create_layout() (lp: #981376)
 -- Sebastien Bacher <email address hidden> Thu, 04 Apr 2013 19:14:40 +0200

Changed in pygtk (Ubuntu):
status: Fix Committed → Fix Released
Changed in pygtk:
status: New → Invalid
Changed in pygtk (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.