blob: c935dd6f2c23b2381c065cda85abb71014705b02 (
plain)
1 From eca72baa5616fbe4dbebea43c7e5940847dc5ab8 Mon Sep 17 00:00:00 2001
2 From: "Owen W. Taylor" <otaylor@fishsoup.net>
3 Date: Tue, 27 Sep 2011 00:17:52 -0400
4 Subject: Fix leaks of Pango objects
5
6 Gtk.PrintContext.create_pango_context()
7 Gtk.PrintContext.create_pango_layout()
8 pangocairo.CairoContext.create_layout()
9
10 were leaking the objects they returned.
11
12 https://bugzilla.gnome.org/show_bug.cgi?id=660216
13
14 diff --git a/gtk/gtk-2.10.defs b/gtk/gtk-2.10.defs
15 index 69c7e0c..faa45e1 100644
16 --- a/gtk/gtk-2.10.defs
17 +++ b/gtk/gtk-2.10.defs
18 @@ -1388,12 +1388,14 @@
19 (define-method create_pango_context
20 (of-object "GtkPrintContext")
21 (c-name "gtk_print_context_create_pango_context")
22 + (caller-owns-return #t)
23 (return-type "PangoContext*")
24 )
25
26 (define-method create_pango_layout
27 (of-object "GtkPrintContext")
28 (c-name "gtk_print_context_create_pango_layout")
29 + (caller-owns-return #t)
30 (return-type "PangoLayout*")
31 )
32
33 diff --git a/pangocairo.override b/pangocairo.override
34 index bb923e6..5101107 100644
35 --- a/pangocairo.override
36 +++ b/pangocairo.override
37 @@ -118,11 +118,16 @@ _wrap_pango_cairo_update_context(PyGObject *self, PyObject *args, PyObject *kwar
38 static PyObject *
39 _wrap_pango_cairo_create_layout(PyGObject *self)
40 {
41 - PangoLayout *ret;
42 + PangoLayout *layout;
43 + PyObject *ret;
44
45 - ret = pango_cairo_create_layout(PycairoContext_GET(self));
46 + layout = pango_cairo_create_layout(PycairoContext_GET(self));
47 /* pygobject_new handles NULL checking */
48 - return pygobject_new((GObject *)ret);
49 + ret = pygobject_new((GObject *)layout);
50 + if (layout)
51 + g_object_unref(layout);
52 +
53 + return ret;
54 }
55
56 static PyObject *
57 --
58 cgit v0.10.2
|